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

Add experimental Temporal support #1467

Open
arthurschreiber opened this issue Jul 12, 2022 · 2 comments
Open

Add experimental Temporal support #1467

arthurschreiber opened this issue Jul 12, 2022 · 2 comments
Assignees

Comments

@arthurschreiber
Copy link
Collaborator

arthurschreiber commented Jul 12, 2022

There's an upcoming EcmaScript specification that adds better date and time handling support to JavaScript.

The functionality in this specification would allow us to greatly improve the support different date and time related data types.

Here's a list of SQL Server data types and the corresponding types from the temporal spec that they should map to/from:

  • date -> Temporal.PlainDate
  • datetime -> Temporal.PlainDateTime
  • datetime2 -> Temporal.PlainDateTime
  • datetimeoffset -> Temporal.ZonedDateTime
  • smalldatetime -> Temporal.PlainDateTime
  • time -> Temporal.PlainTime

With the experimental feature turned on, we shouldn't support Date objects at all anymore - their handling is awkward and error prone.

There's two polyfills available that we could use to implement this:

Polyfill Repo Status
@js-temporal/polyfill js-temporal/temporal-polyfill Alpha release available
temporal-polyfill fullcalendar/temporal Alpha release available
@arthurschreiber
Copy link
Collaborator Author

If the experimental temporal support is not enabled, we could still use temporal objects internally (instead of js-joda) and just return Date objects instead.

@arthurschreiber
Copy link
Collaborator Author

Here's some information on how to convert Temporal objects back into Date objects: https://tc39.es/proposal-temporal/docs/cookbook.html#temporal-types--legacy-date

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

No branches or pull requests

2 participants