observablehq / inputs

Better input elements
https://observablehq.com/framework/lib/inputs
ISC License
127 stars 34 forks source link

Default value for datetime is translated to UTC in form element, whereas local-time is expected. #254

Closed TomvanTilburg-geodan closed 1 year ago

TomvanTilburg-geodan commented 1 year ago

When providing a default value to the Inputs.datetime, it is translated from localtime to UTC time in the input. According to the specs though, the input itself should display local-time. As an effect the result of the input is always off (unless you live at GMT).

Expectd:

viewof newdatetime = Inputs.datetime({value: new Date('2023-06-01T12:00:00')});
newdatetime -> '2023-06-01T12:00:00'

Observed:

viewof newdatetime = Inputs.datetime({value: new Date('2023-06-01T12:00:00')});
newdatetime -> '2023-06-01T10:00:00'

Example can be found in: https://observablehq.com/d/476e59d057eca559

mbostock commented 1 year ago

Already fixed in #244 but we haven’t gotten around to releasing it yet. :(

tophtucker commented 1 year ago

Fix has just (finally) been released; see test cases here: https://observablehq.com/d/4303b3734fb950d8. Thanks for the nudge @TomvanTilburg-geodan; we've updated our internal processes so more people can publish these releases and it shouldn't be quite such a bottleneck in the future.