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

Merged
merged 12 commits into from
Jan 15, 2025

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

github-actions bot commented Jan 13, 2025

Test262 conformance changes

Test result main count PR count difference
Total 50,254 50,254 0
Passed 45,171 45,343 +172
Ignored 1,728 1,728 0
Failed 3,355 3,183 -172
Panics 0 0 0
Conformance 89.89% 90.23% +0.34%
Fixed tests (175):
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/ZonedDateTime/prototype/toPlainDateTime/basic.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/negative-epochnanoseconds.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/basic.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/negative-epochnanoseconds.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/Duration/prototype/round/relativeto-zoneddatetime-negative-epochnanoseconds.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 (3):
test/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/time-zone-canonicalized.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)

@nekevss nekevss added enhancement New feature or request builtins PRs and Issues related to builtins/intrinsics labels Jan 13, 2025
@nekevss nekevss requested a review from a team January 13, 2025 14:57
@hansl
Copy link
Contributor

hansl commented Jan 13, 2025

Any good reasons new tests broke?

@nekevss
Copy link
Member Author

nekevss commented Jan 13, 2025

At least 3 of them should be false positives as those methods were not previously supported. The add test is potentially a bug vs. a false positive. But that will need to be looked into and followed up on temporal_rs.

Either way, I'll be putting them on my broken test list 😄

@nekevss nekevss added this pull request to the merge queue Jan 15, 2025
Merged via the queue into main with commit b2ba5f6 Jan 15, 2025
13 checks passed
@nekevss nekevss deleted the impl-temporal-to-string-methods branch January 15, 2025 22:21
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