4 ms·
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
by dr_kiszonka 3y ago
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.)
- submain 3y agojust like you don't roll your own crypto, you don't roll your own date libraries.
- anoopelias 3y agoFrom "Falsehoods Programmers believes in" series: https://news.ycombinator.com/item?id=4128208 https://news.ycombinator.com/item?id=4128208
- wruza 3y agoAnother 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.
- alickz 3y agoDatetime and phonenumbers are two subjects that are notorious for how complex they are despite seemingly simple everyday concepts
- sensanaty 3y agoI 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