loading...

Discussion on: Dates are hard folks

Collapse
shiraazm profile image
Shiraaz Moollatjie

Back when Flash/Flex was still a thing, user's used to submit date objects in forms. That time the rpc protocol used was something called BlazeDS.

What this BlazeDS used to do, is serialize the date with the timezone information and then send it over to the server (So you select 2020-02-03 as a date, it will send 2020-02-03 02:00am). Then the server would deserialize that date in it's timezone (so 2020-02-03 02:00am back to 2020-02-03 00:00).

All fine and well, because this was for a backoffice application. Until the day our software got deployed in a multinational company sitting between two timezones. So client sends a date in a +2 timezone, and the server sits in a +1 timezone.

Because two different timezones were being used for serialization/deserialization on on the client/server, the incorrect dates were always being used in ALL screens (50 or so). Took a good day or two for me to figure it out.

TL;DR; Always send dates over as strings and as UTC time.

Collapse
terpinmd profile image
terpinmd

even better send them as a number representing milliseconds

Collapse
shiraazm profile image
Shiraaz Moollatjie

it depends on the language you use. I wouldn't recommend this for Go specifically.