logoalt Hacker News

sevensor12/08/20243 repliesview on HN

Strongly disagree about datetimes; they exist at a different semantic level and are entirely too easy to get wrong.


Replies

wruza12/09/2024

Not more than a string representing a date that gets interpreted after json.parse.

int_19h12/09/2024

Luckily, we have decades of experience in e.g. SQL, and existing and well-polished ISO specs on dates that can just be used as is without reinventing the wheel.

show 2 replies
eknkc12/10/2024

I mean, floating point numbers are easy to get wrong. And why care about semantics? This is a data transfer format, it should be able to represent data that is being transferred gazillion times a day.

Make it raw ISO 8601 { "created_at": 2024-12-10T11:20:07Z } and do not accept any other format. I know there are way smarter people than me who can figure this out at this point.

DateTimes are the number 1 reason I can not use JSON data as is (if I simply parse it into a dynamic object like JSON.parse).