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 more toString and toJSON methods on Temporal builtins #4126

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Jan 13, 2025

This Pull Request is related to ongoing work for #4072, #4073, #4074, and #4075

It changes the following:

  • Bumps temporal_rs version with some various bug fixes.
  • Implements toString and toJSON for PlainDateTime
  • Implements toString and toJSON for PlainTime
  • Implements toString and toJSON for Instant
  • Implements toString and toJSON for ZonedDateTime
  • Adds options::get_digit_options utility method

@nekevss nekevss changed the title Implement mroe toString and toJSON methods on Temporal builtins Implement more toString and toJSON methods on Temporal builtins Jan 13, 2025
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 50,254 50,254 0
Passed 45,171 45,337 +166
Ignored 1,728 1,728 0
Failed 3,355 3,189 -166
Panics 0 0 0
Conformance 89.89% 90.22% +0.33%
Fixed tests (170):
test/intl402/Temporal/Instant/prototype/toString/timezone-offset.js (previously Failed)
test/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/offset-time-zone-not-supported.js (previously Failed)
test/intl402/Temporal/PlainDateTime/prototype/toString/calendarname-undefined.js (previously Failed)
test/intl402/Temporal/PlainDateTime/prototype/toString/calendarname-never.js (previously Failed)
test/intl402/Temporal/PlainDateTime/prototype/toString/calendarname-auto.js (previously Failed)
test/intl402/Temporal/PlainDateTime/prototype/toString/options-undefined.js (previously Failed)
test/intl402/Temporal/PlainDateTime/prototype/toString/calendarname-always.js (previously Failed)
test/intl402/Temporal/PlainDateTime/prototype/toString/calendarname-critical.js (previously Failed)
test/intl402/Temporal/PlainDateTime/prototype/toString/calendarname-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toJSON/name.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toJSON/length.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toJSON/branding.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toJSON/not-a-constructor.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toJSON/basic.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toJSON/prop-desc.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toJSON/builtin.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/options-object.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-invalid-string.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-fractionalseconddigits.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/options-invalid.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-auto.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-ceil.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/options-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfExpand.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfFloor.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/branding.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-out-of-range.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-undefined.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfEven.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/rounding-cross-midnight.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-expand.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/options-undefined.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-valid-units.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-invalid-string.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfCeil.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-undefined.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/basic.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-number.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/prop-desc.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/smallestunit-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-invalid-string.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-floor.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfTrunc.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/order-of-operations.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/roundingmode-trunc.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-undefined.js (previously Failed)
test/built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-nan.js (previously Failed)
test/built-ins/Temporal/Instant/from/argument-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/compare/argument-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/equals/argument-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toJSON/name.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toJSON/length.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toJSON/branding.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toJSON/not-a-constructor.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toJSON/basic.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toJSON/prop-desc.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toJSON/builtin.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/until/argument-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/timezone-offset.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/options-object.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/smallestunit-invalid-string.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/smallestunit-fractionalseconddigits.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-auto.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-ceil.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/options-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-halfExpand.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-halfFloor.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/branding.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-out-of-range.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-undefined.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-halfEven.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/rounding-cross-midnight.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-expand.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/smallestunit-valid-units.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-invalid-string.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-halfCeil.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/smallestunit-undefined.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-number.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/prop-desc.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/smallestunit-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/precision.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-invalid-string.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-floor.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/timezone-string.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-halfTrunc.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/timezone-wrong-type.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/order-of-operations.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/roundingmode-trunc.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-undefined.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-nan.js (previously Failed)
test/built-ins/Temporal/Instant/prototype/since/argument-wrong-type.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-string-optional-parts.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-string-basic-and-extended-format.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-string-variant-decimal-separator.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/from/argument-string-decimal-places.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/incorrectly-spelled-properties-ignored.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/basic.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/name.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/length.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/branding.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/not-a-constructor.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/prop-desc.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toJSON/builtin.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/offset-invalid-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-invalid-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/options-wrong-type.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-invalid-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/branding.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-out-of-range.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-invalid-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/prop-desc.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-invalid-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-invalid-string.js (previously Failed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-nan.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/name.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/length.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/branding.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/not-a-constructor.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/basic.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/prop-desc.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/builtin.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toJSON/year-format.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/options-object.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-undefined.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-never.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-invalid-string.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-fractionalseconddigits.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-auto.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-ceil.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/options-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/rounding-edge-of-range.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfExpand.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfFloor.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-auto.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/branding.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-out-of-range.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-undefined.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfEven.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/rounding-cross-midnight.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-expand.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-valid-units.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-invalid-string.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfCeil.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-undefined.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/basic.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-number.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-always.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/prop-desc.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-critical.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-invalid-string.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-floor.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfTrunc.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-wrong-type.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-invalid-string.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/order-of-operations.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-trunc.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/year-format.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-undefined.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/rounding-direction.js (previously Failed)
test/built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-nan.js (previously Failed)
Broken tests (4):
test/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/time-zone-canonicalized.js (previously Passed)
test/built-ins/Temporal/Instant/prototype/add/cross-epoch.js (previously Passed)
test/built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/return-string.js (previously Passed)
test/built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-plurals-accepted.js (previously Passed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant