3 ms·
I don't know where POSIX stands on this, but I think the real WTF of JavaScript's months starting at 0 is that the days start at 1. Pick one!
by anamexis 5y ago
I don't know where POSIX stands on this, but I think the real WTF of JavaScript's months starting at 0 is that the days start at 1. Pick one!
- jcranmer 5y agoPOSIX does the same thing.
- randomswede 5y agoETA: Ahaha, I managed to read "days" as "weekdays". The following is now. permanent marker of my reading incomprehension. IIRC (and it's been a while, so I may well not RC), specifies that 1 is Monday, 2 is Tuesday, ..., 6 is Saturday and both 0 and 7 are Sunday. And the reason that looks weird is that there is (IIUC) a genuine difference between western nations as to if a week starts o Sunday or Monday. Which, you know, sucks. But, also makes it somewhat easy to make a C array that you can index with a (.tm_wday%7) to easily get the day of the week. Which may also be the reason why months start at 0.