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

One thing I have learned from HN is that datetime issues are hard, prolific, programming language agnostic, and not to trust myself to get the logic right. (The same applies to floats.)


Another thing programmers should know and fix is that most of it is self-inflicted. When there’s no easy way to add a day, people add 86400000 and stumble upon a leap second. When time is not needed, they use fixed hours and fail at timezones. And so on. Most date libraries provide mostly trivial and at the same time low-level use-cases, so people do all the stupid math with what essentially is an irregularly-based number.


just like you don't roll your own crypto, you don't roll your own date libraries.


Takes me less to launch some coin fork than getting even a single date time api correctly.


The API is correct, you just called it at the wrong time


Facts!


Datetime and phonenumbers are two subjects that are notorious for how complex they are despite seemingly simple everyday concepts


From "Falsehoods Programmers believes in" series:

https://news.ycombinator.com/item?id=4128208


I haven't had too many true hair-pulling moments in my life as a programmer, but the majority of them were because of datetime issues.

My brain just doesn't get the concept I guess, I always struggle a lot whenever I need to touch anything that does anything with dates/time




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

Search: