TIL in Javascript, Date `getMonth()` does not give the correct month as we expect 🤯

by @rinas

today = new Date()
Thu May 05 2022 19:28:34 GMT+0530 (India Standard Time)
today.getMonth()
4

what! it should be 5 (May!)

looks like the return values are from 0 to 11

so for now we'll have to do today.getMonth() + 1 to get correct month value


https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth#return_value

Regarding privacy concerns, it's simple - we don't sell your data. In fact, we try to use privacy-focused software/services like Fathom Analytics whenever we use any third-party services.