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(
}
if (FLAG_harmony_intl_dateformat_fractional_second_digits) {
int fsd = FractionalSecondDigitsFromPattern(pattern);
CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->fractionalSecondDigits_string(),
factory->NewNumberFromInt(fsd), Just(kDontThrow))
.FromJust());
if (fsd > 0) {
CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->fractionalSecondDigits_string(),
factory->NewNumberFromInt(fsd), Just(kDontThrow))
.FromJust());
}
}
}
......
......@@ -71,7 +71,6 @@ var expectedProperties = [
'minute',
'second',
'timeZoneName',
'fractionalSecondDigits',
];
assertEquals(expectedProperties.length, properties.length);
......
......@@ -5,7 +5,7 @@
// Flags: --harmony_intl_dateformat_fractional_second_digits
assertEquals(
0,
undefined,
(new Intl.DateTimeFormat("en", {fractionalSecondDigits: 0}))
.resolvedOptions().fractionalSecondDigits);
......@@ -25,14 +25,14 @@ assertEquals(
.resolvedOptions().fractionalSecondDigits);
// 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.
assertEquals(
0,
undefined,
(new Intl.DateTimeFormat()).resolvedOptions().fractionalSecondDigits);
assertEquals(
0,
undefined,
(new Intl.DateTimeFormat("en", {fractionalSecondDigits: undefined}))
.resolvedOptions().fractionalSecondDigits);
......
......@@ -665,9 +665,6 @@
# https://crbug.com/v8/10688
'language/expressions/optional-chaining/eval-optional-call': [FAIL],
# https://crbug.com/v8/10686
'intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid': [FAIL],
######################## NEEDS INVESTIGATION ###########################
# 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