Skip to content

Convert date fields to UTC on the client#410

Open
carlosjdelgado wants to merge 2 commits into
hunvreus:developmentfrom
carlosjdelgado:feat/date-utc-tz
Open

Convert date fields to UTC on the client#410
carlosjdelgado wants to merge 2 commits into
hunvreus:developmentfrom
carlosjdelgado:feat/date-utc-tz

Conversation

@carlosjdelgado

Copy link
Copy Markdown

Datetime values lost their timezone on the server-side read/write round-trip because the form input has no offset and Vercel runs in UTC: a user in Madrid typing 14:30 ended up stored as 14:30Z. The fix moves the timezone-aware conversion to the browser, where the local offset is known.

Edit and view components now treat the stored wall-clock as UTC and shift to local for display; on submit the local input is converted back to a UTC wall-clock. The server keeps doing exactly what it did before (naive parse and format) and, being in UTC, that round-trips correctly.

Closes #247.

Datetime values lost their timezone on the server-side read/write round-trip
because the form input has no offset and Vercel runs in UTC: a user in Madrid
typing 14:30 ended up stored as 14:30Z. The fix moves the timezone-aware
conversion to the browser, where the local offset is known.

Edit and view components now treat the stored wall-clock as UTC and shift to
local for display; on submit the local input is converted back to a UTC
wall-clock. The server keeps doing exactly what it did before (naive parse
and format) and, being in UTC, that round-trips correctly.

Closes hunvreus#247.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant