I feel that something is missing here.
The Date.getDay () method must return a value between 0 and 6. 0 for Sunday and 6 for Saturday.
Now I have two dates, both Sunday, which should return 0.
new Date('1990-11-11').getDay() // returns 6 new Date('2016-1-3').getDay() // returns 0
What causes the mismatch? I dare to question the validity of the .getDay()
method, but I cannot understand what is happening.
EDIT
> new Date('1990-11-11') Sat Nov 10 1990 17:00:00 GMT-0700 (MST) > new Date('2016-01-03') Sat Jan 02 2016 17:00:00 GMT-0700 (MST) > new Date('2016-1-3')
I do not understand what is going on. January 3 - Sunday and November 11, 1990 - Sunday. Why is he talking on Saturday?
source share