'Thu Oct 01 2015 00:00:00 GMT-0300'
'Wed Sep 30 2015 21:00:00 GMT-0300'
What I see after executing locally is
As per the MDN docs,
Date.parse will assume the date to be UTC format if it has complete
DD else it will assume in local timezone format.
Detailed explanation regarding month change: (comments)
new Date('2015-10-1') when you execute this statement output is 'Thu Oct 01 2015 00:00:00 GMT-0300'. i.e. its your local time and it is GMT -3hrs.
But when you execute the
new Date('2015-10-01') the output is 'Wed Sep 30 2015 21:00:00 GMT-0300' which is in UTC time. i.e. 3hrs minus from your local time.
So it is 1st Oct midnight -3hrs, which is previous day's 21hrs. i.e. Sep 30 21hrs.