O'Reilly logo
  • Martin Wehlou thinks this is interesting:

Note that the JavaScript function getMonth returns 0 - 11, and not 1 - 12, so we are correcting this by adding 1.

From

Cover of Mastering TypeScript - Second Edition

Note

well, yes, but Date(year, month, date) also takes a month value of 0-11 according to docs, so you shouldn't add 1 here.