new Date() returning different values for time zones, with different inputs

var date1 = "2015-03-29";
console.log(new Date(date1)); //Output:Sun Mar 29 2015 05:30:00 GMT+0530 (India Standard Time)

var date2 = "1869-12-31";
console.log(new Date(date2)); //Output:Fri Dec 31 1869 05:53:20 GMT+0553 (India Standard Time)

var date3 = "1870-01-01";
console.log(new Date(date3)); //Output:Sat Jan 01 1870 05:21:10 GMT+0521 (India Standard Time)

When debugging some Date() related issues, saw the above behavior of Date() with different inputs.

The time zone is different for all the three inputs even though my System time zone is GMT +05:30

Is this expected?

Thanks for any help in advance!

Read more here:

Content Attribution

This content was originally published by senthil at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: