1

Date.prototype.getDay() is an integer number, between 0 and 6
Date.prototype.getMonth() also an integer number, between 0 and 11
then why Date.prototype.getDate() is the only function that between 1 and 31? why didn't it starts from 0 ?

Imesh Chamara
  • 162
  • 12

1 Answers1

-2

Because if you look at a calendar you'll notice that the first day of any month is 1 instead of 0.

Barbaldo
  • 72
  • 3
  • 11
  • Also very related to this https://stackoverflow.com/questions/9687521/javascript-date-method-inconsistency-getdate-vs-getmonth – Barbaldo Feb 12 '21 at 17:29