MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/btxz72/what_are_some_javascript_things_beginners_dont/ep53x49/?context=9999
r/javascript • u/[deleted] • May 28 '19
383 comments sorted by
View all comments
247
Months are zero based
0 u/[deleted] May 28 '19 [deleted] 5 u/amdc !CURSED! May 28 '19 that's pretty much everywhere 0 u/[deleted] May 28 '19 [deleted] 7 u/blood_bender May 28 '19 I'm not positive it's an array underneath, but either way, months are special (or I guess days are special). First day of the month is 1, first month of the year is 0. It's not consistent which has always bothered me. 3 u/TheIncorrigible1 May 28 '19 It feels like someone designed months as if they were an enum and gave up on the rest of the Date API. Although, getDay() is also zero-based.
0
[deleted]
5 u/amdc !CURSED! May 28 '19 that's pretty much everywhere 0 u/[deleted] May 28 '19 [deleted] 7 u/blood_bender May 28 '19 I'm not positive it's an array underneath, but either way, months are special (or I guess days are special). First day of the month is 1, first month of the year is 0. It's not consistent which has always bothered me. 3 u/TheIncorrigible1 May 28 '19 It feels like someone designed months as if they were an enum and gave up on the rest of the Date API. Although, getDay() is also zero-based.
5
that's pretty much everywhere
0 u/[deleted] May 28 '19 [deleted] 7 u/blood_bender May 28 '19 I'm not positive it's an array underneath, but either way, months are special (or I guess days are special). First day of the month is 1, first month of the year is 0. It's not consistent which has always bothered me. 3 u/TheIncorrigible1 May 28 '19 It feels like someone designed months as if they were an enum and gave up on the rest of the Date API. Although, getDay() is also zero-based.
7 u/blood_bender May 28 '19 I'm not positive it's an array underneath, but either way, months are special (or I guess days are special). First day of the month is 1, first month of the year is 0. It's not consistent which has always bothered me. 3 u/TheIncorrigible1 May 28 '19 It feels like someone designed months as if they were an enum and gave up on the rest of the Date API. Although, getDay() is also zero-based.
7
I'm not positive it's an array underneath, but either way, months are special (or I guess days are special). First day of the month is 1, first month of the year is 0. It's not consistent which has always bothered me.
3 u/TheIncorrigible1 May 28 '19 It feels like someone designed months as if they were an enum and gave up on the rest of the Date API. Although, getDay() is also zero-based.
3
It feels like someone designed months as if they were an enum and gave up on the rest of the Date API. Although, getDay() is also zero-based.
getDay()
247
u/TrikkyMakk May 28 '19
Months are zero based