evidence icon indicating copy to clipboard operation
evidence copied to clipboard

Dates without timezones display incorrectly during formatting

Open archiewood opened this issue 3 years ago • 0 comments

In timezones outside UTC, passing a date without a timezone will assume UTC, which can lead to unexpected outcomes.

Steps to reproduce

```usage_data
select '2022-06-06' as usage_mmm
```

<Value data={usage_data} column=usage_mmm/>

should display Jun, Instead displays May.

Why

If the date doesn’t have a timezone associated with it, JS date assumes UTC timezone in the backend.

So 2022-06-01 would be 2022-06-01 0:00 UTC

At the time of presenting, JS will look at the timezone on the browser and apply it.

If you are in EST, 2022-06-01 0:00 UTC becomes 2022-05-31 19:00 EST

The month extracted from that would hence be May.

archiewood avatar Jul 21 '22 16:07 archiewood