Skip to content

Timezones not working for fromMillis #403

@loganvolkers

Description

@loganvolkers

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions