Commit 7a4a6cc6 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Add toJSON, toString and non-intl version of toLocaleString to ZonedDateTime

Also add AOs: FormatISOTimeZoneOffsetString, TemporalZonedDateTimeToString, ToShowTimeZoneNameOption, ToShowOffsetOption,

Update FormatTimeZoneOffsetString to use ToZeroPaddedDecimalString

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tolocalestring
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tostring
https://tc39.es/proposal-temporal/#sec-temporal-formatisotimezoneoffsetstring
https://tc39.es/proposal-temporal/#sec-temporal-temporalzoneddatetimetostring
https://tc39.es/proposal-temporal/#sec-temporal-toshowtimezonenameoption
https://tc39.es/proposal-temporal/#sec-temporal-toshowoffsetoption

The intl version of toLocaleString is not implemented in this CL yet


Bug: v8:11544
Change-Id: Id7e4f72b63864857b0b3fa8dc8dfcba0b5949faa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3688848Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81507}
parent adb111b7
......@@ -64,10 +64,6 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeUntil)
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeSince)
/* Temporal #sec-temporal.zoneddatetime.prototype.round */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeRound)
/* Temporal #sec-temporal.zoneddatetime.prototype.tostring */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToString)
/* Temporal #sec-temporal.zonedddatetimeprototype.tojson */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToJSON)
/* Temporal.Duration */
/* Temporal #sec-temporal.duration.compare */
......@@ -91,10 +87,6 @@ TO_BE_IMPLEMENTED(TemporalPlainYearMonthPrototypeSince)
/* Temporal #sec-temporal.calendar.prototype.weekofyear */
TO_BE_IMPLEMENTED(TemporalCalendarPrototypeWeekOfYear)
/* Temporal.ZonedDateTime */
/* Temporal #sec-temporal.zoneddatetime.prototype.tolocalestring */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToLocaleString)
#define TEMPORAL_CONSTRUCTOR1(T) \
BUILTIN(Temporal##T##Constructor) { \
HandleScope scope(isolate); \
......@@ -562,9 +554,12 @@ TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, OffsetNanoseconds, offsetNanoseconds)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, Offset, offset)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, StartOfDay, startOfDay)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToInstant, toInstant)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToJSON, toJSON)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainDate, toPlainDate)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainTime, toPlainTime)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainDateTime, toPlainDateTime)
TEMPORAL_PROTOTYPE_METHOD2(ZonedDateTime, ToLocaleString, toLocaleString)
TEMPORAL_PROTOTYPE_METHOD1(ZonedDateTime, ToString, toString)
TEMPORAL_VALUE_OF(ZonedDateTime)
// Duration
......
This diff is collapsed.
......@@ -938,6 +938,20 @@ class JSTemporalZonedDateTime
ToPlainDateTime(Isolate* isolate,
Handle<JSTemporalZonedDateTime> zoned_date_time);
// #sec-temporal.zoneddatetime.prototype.tojson
V8_WARN_UNUSED_RESULT static MaybeHandle<String> ToJSON(
Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time);
// #sec-temporal.zoneddatetime.prototype.tolocalestring
V8_WARN_UNUSED_RESULT static MaybeHandle<String> ToLocaleString(
Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time,
Handle<Object> locales, Handle<Object> options);
// #sec-temporal.zoneddatetime.prototype.tostring
V8_WARN_UNUSED_RESULT static MaybeHandle<String> ToString(
Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time,
Handle<Object> options);
DECL_PRINTER(JSTemporalZonedDateTime)
TQ_OBJECT_CONSTRUCTORS(JSTemporalZonedDateTime)
......
......@@ -524,8 +524,6 @@
'built-ins/Temporal/Instant/prototype/since/largestunit': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/timezone': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/timezone-offset': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/timezone-string-datetime': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/Instant/prototype/until/argument-zoneddatetime': [FAIL],
......@@ -569,7 +567,6 @@
'built-ins/Temporal/PlainDate/prototype/subtract/limits': [FAIL],
'built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-zoneddatetime-balance-negative-time-units': [FAIL],
'built-ins/Temporal/PlainDate/prototype/toPlainDateTime/basic': [FAIL],
'built-ins/Temporal/PlainDate/prototype/toZonedDateTime/basic': [FAIL],
'built-ins/Temporal/PlainDate/prototype/toZonedDateTime/plaintime-argument-zoneddatetime-balance-negative-time-units': [FAIL],
'built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getpossibleinstantsfor-iterable': [SKIP],
'built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-multiple-offsets': [FAIL],
......@@ -961,52 +958,13 @@
'built-ins/Temporal/ZonedDateTime/prototype/since/zoneddatetime-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/zoneddatetime-string-multiple-offsets': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/negative-epochnanoseconds': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/offset': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-non-integer': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-out-of-range': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/year-format': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/return-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-invalid-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-invalid-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-nan': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-out-of-range': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-undefined': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/negative-epochnanoseconds': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/offset': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/offset-invalid-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/offset-undefined': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/offset-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/options-undefined': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-invalid-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-undefined': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-invalid-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-plurals-accepted': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-undefined': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-valid-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-non-integer': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-out-of-range': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-invalid-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-undefined': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/year-format': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/branding': [FAIL],
......@@ -1349,16 +1307,10 @@
'built-ins/Temporal/ZonedDateTime/prototype/round/rounding-direction': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/round/roundto-invalid-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/options-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-auto': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-number': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/options-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/rounding-cross-midnight': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/rounding-direction': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-ceil': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-floor': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-halfExpand': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-trunc': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-fractionalseconddigits': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/options-wrong-type': [FAIL],
'intl402/Temporal/Instant/prototype/toString/timezone-offset': [FAIL],
'intl402/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-calendar': [FAIL],
......@@ -1536,7 +1488,6 @@
'built-ins/Temporal/Instant/from/argument-string': [FAIL],
'built-ins/Temporal/Instant/prototype/add/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/Instant/prototype/subtract/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/timezone-string-leap-second': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/argument-leap-second': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-leap-second': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/argument-propertybag-calendar-year-zero': [FAIL],
......@@ -1591,7 +1542,6 @@
'built-ins/Temporal/ZonedDateTime/prototype/since/timezone-string-leap-second': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/timezone-string-year-zero': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/basic': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-leap-second': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-calendar-year-zero': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-time-separators': [FAIL],
......
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