Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They had me at “all objects are immutable.”

They lost me at “ date time values without time zones.”

I’m mostly kidding with the second line. Working with third-party React calendar components requires doing some moment.js math and then hacking off the last few characters of the .toISOString() to make the calendar happy. So I can see how it’s a very practical addition. Please don’t misuse it.



They lost me at “ date time values without time zones.”

This is rather useful for date of birth, which shouldn't be set to a time zone in most use cases (it can get rather confusing if you do).


Every DOB field I’ve seen is just a date, with no timestamp at all.


There’s a footgun when you convert DOBs to Date objects. This can return different dates depending on the local timezone:

``` new Date("1/1/2021").toLocaleDateString() ```

If you want it to return the same DOB regardless of local timezone, you have to pass a timezone to the Date constructor, which is not super obvious. This kind of bug is also unlikely to get caught by unit tests unless you’re testing date formatting for different timezones, which you probably wouldn’t do if you’re not aware of the footgun to begin with.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: