Commit d3fe0e29 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

Return undefined if fractionalSecondDigits is 0

Bug: v8:10686
Change-Id: I5a7b47dd4ed10142a795de56c4739ab072e63421
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2286814
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarFrank Tang <ftang@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68773}
parent 34871edd
...@@ -650,10 +650,12 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions( ...@@ -650,10 +650,12 @@ MaybeHandle<JSObject> JSDateTimeFormat::ResolvedOptions(
} }
if (FLAG_harmony_intl_dateformat_fractional_second_digits) { if (FLAG_harmony_intl_dateformat_fractional_second_digits) {
int fsd = FractionalSecondDigitsFromPattern(pattern); int fsd = FractionalSecondDigitsFromPattern(pattern);
CHECK(JSReceiver::CreateDataProperty( if (fsd > 0) {
isolate, options, factory->fractionalSecondDigits_string(), CHECK(JSReceiver::CreateDataProperty(
factory->NewNumberFromInt(fsd), Just(kDontThrow)) isolate, options, factory->fractionalSecondDigits_string(),
.FromJust()); factory->NewNumberFromInt(fsd), Just(kDontThrow))
.FromJust());
}
} }
} }
......
...@@ -71,7 +71,6 @@ var expectedProperties = [ ...@@ -71,7 +71,6 @@ var expectedProperties = [
'minute', 'minute',
'second', 'second',
'timeZoneName', 'timeZoneName',
'fractionalSecondDigits',
]; ];
assertEquals(expectedProperties.length, properties.length); assertEquals(expectedProperties.length, properties.length);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Flags: --harmony_intl_dateformat_fractional_second_digits // Flags: --harmony_intl_dateformat_fractional_second_digits
assertEquals( assertEquals(
0, undefined,
(new Intl.DateTimeFormat("en", {fractionalSecondDigits: 0})) (new Intl.DateTimeFormat("en", {fractionalSecondDigits: 0}))
.resolvedOptions().fractionalSecondDigits); .resolvedOptions().fractionalSecondDigits);
...@@ -25,14 +25,14 @@ assertEquals( ...@@ -25,14 +25,14 @@ assertEquals(
.resolvedOptions().fractionalSecondDigits); .resolvedOptions().fractionalSecondDigits);
// When timeStyle and dateStyle is not present, GetNumberOption will fallback // When timeStyle and dateStyle is not present, GetNumberOption will fallback
// to 0 as default regardless fractionalSecondDigits is present in the option or // to undefined as default regardless fractionalSecondDigits is present in the option or
// not. // not.
assertEquals( assertEquals(
0, undefined,
(new Intl.DateTimeFormat()).resolvedOptions().fractionalSecondDigits); (new Intl.DateTimeFormat()).resolvedOptions().fractionalSecondDigits);
assertEquals( assertEquals(
0, undefined,
(new Intl.DateTimeFormat("en", {fractionalSecondDigits: undefined})) (new Intl.DateTimeFormat("en", {fractionalSecondDigits: undefined}))
.resolvedOptions().fractionalSecondDigits); .resolvedOptions().fractionalSecondDigits);
......
...@@ -665,9 +665,6 @@ ...@@ -665,9 +665,6 @@
# https://crbug.com/v8/10688 # https://crbug.com/v8/10688
'language/expressions/optional-chaining/eval-optional-call': [FAIL], 'language/expressions/optional-chaining/eval-optional-call': [FAIL],
# https://crbug.com/v8/10686
'intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid': [FAIL],
######################## NEEDS INVESTIGATION ########################### ######################## NEEDS INVESTIGATION ###########################
# https://bugs.chromium.org/p/v8/issues/detail?id=7833 # https://bugs.chromium.org/p/v8/issues/detail?id=7833
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment