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

Support Temporal.Instant for Timestamp columns #856

Closed
zadeviggers opened this issue May 1, 2024 · 2 comments
Closed

Support Temporal.Instant for Timestamp columns #856

zadeviggers opened this issue May 1, 2024 · 2 comments

Comments

@zadeviggers
Copy link

zadeviggers commented May 1, 2024

The Temporal API is now available in Deno. Given this library's popularity in the Deno ecosystem, I think it would make sense to support passing Temporal.Instant objects the same way we can currently pass Date objects.

You can easily convert a Temporal.Instant to a Date like so:

// From the Temporal cookbook: https://tc39.es/proposal-temporal/docs/instant.html#interoperability-with-date
instant = Temporal.Instant.from('2020-01-01T00:00:00.123456789+05:30');
                                                           // => 2019-12-31T18:30:00.123456789Z
date = new Date(instant.epochMilliseconds);

Supporting the more advanced Temporal types, like Temporal.ZonedDateTime for Timestamptzs or Temporal.Duration for Intervals, could also be an interesting thing to pursue in the future.

@langpavel
Copy link

Note that you must run deno --unstable-temporal

@porsager
Copy link
Owner

Should be fairly trivial with a custom type? https://github.com/porsager/postgres?tab=readme-ov-file#custom-types

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

No branches or pull requests

3 participants