Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement toString and toJSON methods for the remaining builtins Duration, PlainMonthDay, and PlainYearMonth #4135

Merged
merged 5 commits into from
Jan 18, 2025

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Jan 18, 2025

This Pull Request is related to ongoing work for #1804

It changes the following:

  • Adds toJSON and toString for PlainYearMonth
  • Adds toJSON and toString for PlainMonthDay
  • Adds toJSON and toString for Duration
  • Bumps temporal_rs to most recent git revision
  • Reorders some of the impl blocks for PlainMonthDay to align with other temporal builtin ordering

Copy link

github-actions bot commented Jan 18, 2025

Test262 conformance changes

Test result main count PR count difference
Total 50,254 50,254 0
Passed 45,437 45,611 +174
Ignored 1,634 1,634 0
Failed 3,183 3,009 -174
Panics 0 0 0
Conformance 90.41% 90.76% +0.35%
Fixed tests (175):
test/intl402/Temporal/Now/zonedDateTimeISO/timezone-string.js (previously Failed)
test/intl402/Temporal/PlainMonthDay/prototype/toJSON/year-format.js (previously Failed)
test/intl402/Temporal/PlainMonthDay/prototype/toJSON/calendarname.js (previously Failed)
test/intl402/Temporal/PlainMonthDay/prototype/toString/calendarname-never.js (previously Failed)
test/intl402/Temporal/PlainMonthDay/prototype/toString/year-format.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/etc-timezone.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-northamerica.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-asia.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-africa.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-etcetera.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-australasia.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-backzone.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/non-canonical-utc.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-europe.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/links-backward.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/iana-legacy-names.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/from/etc-timezone.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/default-includes-time-and-time-zone-name.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/withCalendar/preserves-time-zone.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/toString/calendarname-never.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/toString/calendarname-auto.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/toString/calendarname-always.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/toString/calendarname-critical.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toString/calendarname-undefined.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toString/calendarname-never.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toString/calendarname-auto.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toString/options-undefined.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toString/calendarname-always.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toString/calendarname-critical.js (previously Failed)
test/intl402/Temporal/PlainYearMonth/prototype/toString/calendarname-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainDate/prototype/subtract/argument-duration-max.js (previously Failed)
test/built-ins/Temporal/PlainDate/prototype/add/argument-duration-max.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/subtract/argument-duration-max.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/add/argument-duration-max.js (previously Failed)
test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/from/length.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/name.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/length.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/branding.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/not-a-constructor.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/prop-desc.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/prototype/toJSON/builtin.js (previously Failed)
test/built-ins/Temporal/PlainMonthDay/prototype/toString/length.js (previously Failed)
test/built-ins/Temporal/Duration/from/argument-duration-out-of-range.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/round/out-of-range-when-converting-from-normalized-duration.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/round/relativeto-undefined-throw-on-calendar-units.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/round/precision-exact-in-balance-time-duration.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/subtract/argument-duration-out-of-range.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/subtract/precision-no-floating-point-loss.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toJSON/options.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toJSON/max-value.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toJSON/branding.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toJSON/basic.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toJSON/balance-subseconds.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toJSON/negative-components.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/add/argument-duration-out-of-range.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/add/precision-no-floating-point-loss.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/options-object.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/smallestunit-invalid-string.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/smallestunit-fractionalseconddigits.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-auto.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/roundingmode-ceil.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-wrong-type.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/options-wrong-type.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/throws-when-rounded-duration-is-invalid.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/roundingmode-halfExpand.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/max-value.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/length.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/branding.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-out-of-range.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/roundingmode-undefined.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/smallestunit-plurals-accepted.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/options-undefined.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/smallestunit-valid-units.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-invalid-string.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/smallestunit-undefined.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-number.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/smallestunit-wrong-type.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-exact-number-of-digits.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/roundingmode-wrong-type.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/precision.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/roundingmode-invalid-string.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/roundingmode-floor.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/blank-duration-precision.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/round-cross-unit-boundary.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/balance-subseconds.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/balance.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/order-of-operations.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/roundingmode-trunc.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-undefined.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/total-of-duration-time-units-out-of-range.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-nan.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/negative-components.js (previously Failed)
test/built-ins/Temporal/Duration/prototype/toString/no-precision-loss.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/timezone-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-string-time-zone-annotation.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-string-date-with-utc-offset.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-string-time-separators.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/return-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-duration-max.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/offset.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/basic.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/balance-negative-time-units.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/add/argument-duration-max.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/options-object.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-auto.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/offset.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/offset-auto.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-never.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/offset-never.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-fractionalseconddigits.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-auto.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-critical.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-auto.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-undefined.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-plurals-accepted.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/rounding-cross-midnight.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-undefined.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-number.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-always.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-wrong-type.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-wrong-type.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-critical.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/balance-negative-time-units.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-floor.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-never.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/order-of-operations.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-trunc.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-undefined.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/subclass.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/calendar-always.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/basic.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/refisoday-undefined.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/from/argument-string-unknown-annotation.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/from/argument-string-time-zone-annotation.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/from/argument-string.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/from/argument-plainyearmonth.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/from/argument-string-calendar-annotation.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/from/subclassing-ignored.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/from/argument-string-time-separators.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/with/length.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/options-object.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/argument-object.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-undefined.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/argument-string.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/length.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/argument-duration-object.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/subclassing-ignored.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toJSON/name.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toJSON/length.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toJSON/branding.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toJSON/not-a-constructor.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toJSON/prop-desc.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toJSON/builtin.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toJSON/year-format.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/until/length.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/options-object.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/argument-object.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/overflow-undefined.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/argument-string.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/length.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/argument-duration-object.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/subclassing-ignored.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/add/overflow-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toString/length.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-always.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-critical.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/toString/year-format.js (previously Failed)
test/built-ins/Temporal/PlainYearMonth/prototype/since/length.js (previously Failed)
Broken tests (1):
test/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/offset-time-zone-not-supported.js (previously Passed)

@nekevss nekevss added enhancement New feature or request builtins PRs and Issues related to builtins/intrinsics labels Jan 18, 2025
@nekevss nekevss requested a review from a team January 18, 2025 08:08
@nekevss
Copy link
Member Author

nekevss commented Jan 18, 2025

The broken test should be a false positive as toLocaleString is not implemented. The test itself though was apparently removed from test262 recently for being invalid due to spec updates tc39/test262#4343.

@raskad raskad requested a review from a team January 18, 2025 17:45
@raskad raskad added this to the next-release milestone Jan 18, 2025
@HalidOdat HalidOdat added this pull request to the merge queue Jan 18, 2025
Merged via the queue into main with commit d55c691 Jan 18, 2025
13 checks passed
@HalidOdat HalidOdat deleted the duration-md-ym-to-string branch January 18, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants