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

Timezones not working for fromMillis #403

Closed
loganvolkers opened this issue Jan 24, 2020 · 1 comment · Fixed by #411
Closed

Timezones not working for fromMillis #403

loganvolkers opened this issue Jan 24, 2020 · 1 comment · Fixed by #411
Labels

Comments

@loganvolkers
Copy link
Contributor

It appears that the fromMillis is not respecting the timezone parameter. The docs say that it should default to UTC, but it appears to default to the system/browser timezone. Also you can not manually set the timezone.

Example JSONata expression: http://try.jsonata.org/rymaAsdZ8

[
 $fromMillis(1514808000000, 'Week: [w] of [xNn]'),
 $fromMillis(1514808000000, 'Week: [w] of [xNn]', "+0000"),
 $fromMillis(1514808000000, 'Week: [w] of [xNn]', "+0900")
]

Expected result

[
  "Week: 1 of January",
  "Week: 1 of January",
  "Week: 5 of December"
]

Actual result

[
  "Week: 5 of December",
  "Week: 5 of December",
  "Week: 5 of December"
]

This is causing tests the fail when they are run in other timezones, and likely causing incorrect results for anyone using the fromMillis function.

Also related to #347 and the lack of daylight-savings-time support.

aside I think that this should probably get patched, but also might want to direct people to using their system-native functions for formatting, like the Intl browser API and Luxon or moment.js. Datetime processing is notoriously difficult to get right.

@loganvolkers
Copy link
Contributor Author

🥇 thanks for the quick fix!

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

Successfully merging a pull request may close this issue.

2 participants