Reputation: 86
If i create Date object with new Date('2015-03-25') , I'm getting object as Tue Mar 24 2015 16:00:00 GMT-0800 (AKDT). Is it expected ?
Upvotes: 1
Views: 136
Reputation: 147363
Is it expected?
Unfortunately Ecma TC39 decided that date only forms of ISO 8601 strings should be treated as UTC and not local (per ISO 8601).
You might care to read Matt Johnson's blog on the issue.
The only reliable way to parse date strings is to do it manually. A library can help, but is usually not necessary.
Upvotes: 1