Skip to content

feat(temporal): Limited support for Temporal#1416

Merged
richarddavison merged 5 commits intoawslabs:mainfrom
nabetti1720:feat/temporal
Mar 9, 2026
Merged

feat(temporal): Limited support for Temporal#1416
richarddavison merged 5 commits intoawslabs:mainfrom
nabetti1720:feat/temporal

Conversation

@nabetti1720
Copy link
Copy Markdown
Contributor

@nabetti1720 nabetti1720 commented Feb 24, 2026

Issue # (if available)

n/a

Description of changes

  • This PR will implement Temporal as best as possible, taking full advantage of jiff's capabilities.
  • The core functionality is based on jiff, and llrt_temporal is merely a very thin wrapper to conform to the Temporal specification.
  • In the future, we may consider using temporal_rs to have calendar functionality. However, it would be even better if we could switch to it in the backend for use cases that don't require a calendar, but that's not the goal of this PR.
  • For full support, including the calendar, we will consider using icu and jiff-icu (but not in this PR). If we do, we may place them after the feature gate due to the increased footprint.
    https://github.com/BurntSushi/jiff/blob/master/COMPARE.md#icu-v150

Not included in this PR (postponed to next time)

  • Implement of Temporal.Instant.round()
  • Implement of Temporal.Duration.round()
  • Implement of Temporal.Duration.total()
  • Implement of Temporal.ZoneDateTime.round()
  • Temporal support for Intl.DateTimeFormat()

Checklist

  • Created unit tests in tests/unit and/or in Rust for my feature if needed
  • Ran make fix to format JS and apply Clippy auto fixes
  • Made sure my code didn't add any additional warnings: make check
  • Added relevant type info in types/ directory
  • Updated documentation if needed (API.md/README.md/Other)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@nabetti1720 nabetti1720 force-pushed the feat/temporal branch 4 times, most recently from b4c9989 to 000ee83 Compare February 24, 2026 13:22
@nabetti1720 nabetti1720 force-pushed the feat/temporal branch 23 times, most recently from 3ec136d to 6b6484e Compare February 28, 2026 13:21
@nabetti1720 nabetti1720 marked this pull request as ready for review February 28, 2026 13:21
@nabetti1720
Copy link
Copy Markdown
Contributor Author

@richarddavison Please take a look when you have time. :)

@Sytten
Copy link
Copy Markdown
Collaborator

Sytten commented Feb 28, 2026

The choice of jiff is interesting vs chrono or time (which we probably already have in the tree)

@nabetti1720
Copy link
Copy Markdown
Contributor Author

nabetti1720 commented Feb 28, 2026

The choice of jiff is interesting vs chrono or time (which we probably already have in the tree)

chrono and chrono-tz, which existed in this tree, was replaced by jiff in #1385.

I really like jiff because of its affinity with the Temporal API. This library allows us to focus solely on the interface between rquickjs and jiff.

Here is some interesting documentation about jiff:

@nabetti1720
Copy link
Copy Markdown
Contributor Author

@Sytten It would be great to optimize further if RquickJS supported seamless BigInt<->i128 conversion. Is there a good way to go about this?

@Sytten
Copy link
Copy Markdown
Collaborator

Sytten commented Mar 1, 2026

Make sense! I will have to check it, it is still niche for now so limited support in other libs. Not a fan that it has not seen a release in 1y+

As for BigInt the C API is limited an f64 as far as O remember. You can try to add an API in rquickjs but it will likely need to be added on the C side (guys are pretty responsive though).

@nabetti1720

This comment was marked as off-topic.

@nabetti1720
Copy link
Copy Markdown
Contributor Author

We've added a few more supportable properties to ZonedDateTime. And that's really it.

Copy link
Copy Markdown
Collaborator

@richarddavison richarddavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for the PR, some minor comments and questions to address other wise looks good!

Comment thread libs/llrt_utils/src/result.rs Outdated
Comment thread libs/llrt_utils/src/result.rs Outdated
Comment thread libs/llrt_utils/src/result.rs Outdated
Comment thread modules/llrt_temporal/src/duration.rs Outdated
Comment thread modules/llrt_temporal/src/duration.rs Outdated
Comment thread modules/llrt_temporal/src/instant.rs Outdated
Comment thread modules/llrt_temporal/src/instant.rs
Comment thread modules/llrt_temporal/src/zoned_date_time.rs Outdated
Comment thread modules/llrt_temporal/src/zoned_date_time.rs Outdated
Comment thread modules/llrt_temporal/src/utils/zoned.rs Outdated
@nabetti1720 nabetti1720 force-pushed the feat/temporal branch 2 times, most recently from 36790d7 to 8cb8055 Compare March 2, 2026 12:05
@nabetti1720
Copy link
Copy Markdown
Contributor Author

@richarddavison I think I've fixed most of the issues, but I'd like some further feedback on some of them. :)

@nabetti1720
Copy link
Copy Markdown
Contributor Author

@richarddavison I've rebased it onto the latest main. Of the issues you pointed out in the review, I believe there's only one remaining issue that needs to be resolved. Please let me know if there is anything else I should do. :)

@nabetti1720
Copy link
Copy Markdown
Contributor Author

I've incorporated the last fix.

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.

4 participants