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

Switch to Temporal JS module instead of Date #366

Open
3 of 8 tasks
gcampax opened this issue Jul 19, 2021 · 0 comments
Open
3 of 8 tasks

Switch to Temporal JS module instead of Date #366

gcampax opened this issue Jul 19, 2021 · 0 comments
Labels
bug cleanup Clean ups, refactorings, and code improvements that don't fall under other categories P3 Nice to have, not working on it for now

Comments

@gcampax
Copy link
Contributor

gcampax commented Jul 19, 2021

Temporal (spec, reference) is a newly proposed JS API to handle dates and times. (Currently at Stage 3, which means it is not yet in any ES draft but it is mostly stable)

Unlike traditional JS dates, it is fully timezone aware: it is possible to construct a Temporal object for an arbitrary timezone. This would allow proper conversion between ThingTalk Date and Time.

The steps to incorporate Temporal are:

  1. include the Temporal polyfill
  2. extend the runtime code to handle Temporal objects where Dates are expected (for the "set_time" thingtalk operator, for "==", "+", etc.)
  3. modify Ast.DateValue to carry a Temporal.ZonedDateTime for absolute dates, and treat everything else as incomplete/partial dates
  4. modify the syntax code to use Temporal objects (will require the parser to be timezone-aware)
  5. modify Genie to cope with Temporal objects in ThingTalk results, in ASTs, and in its i18n code
  6. modify Genie's builtin skills to return Temporal objects instead of Date
  7. update type-checking in unit tests to accept Temporal objects
  8. gradually modify all skills that return dates to return Temporal objects
@gcampax gcampax added bug cleanup Clean ups, refactorings, and code improvements that don't fall under other categories labels Jul 19, 2021
@nrser nrser added the P3 Nice to have, not working on it for now label Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cleanup Clean ups, refactorings, and code improvements that don't fall under other categories P3 Nice to have, not working on it for now
Projects
None yet
Development

No branches or pull requests

2 participants