can please update understanding on javascripts new date('') parse?
for example, why this:
var _date = new date('2016-10-15');
equal to
_date = fri oct 14 2016 17:00:00 gmt-0700 (us mountain standard time) {}
and not equal to
oct 15 2016
if use moment.js:
var _testdate = moment('2016-10-15').todate(); _testdate = sat oct 15 2016 00:00:00 gmt-0700 (us mountain standard time) {}
because, contrary iso 8601, date–only forms '2016-10-15' treated utc date constructor , date.parse, whereas libraries moment.js consistent iso 8601 , treat them local.
so since system set utc-0700, '2016-10-15' treated 2016-10-15t00:00:00z (i.e. utc+0000), 2016-10-14 17:00:00 in local time zone.
Comments
Post a Comment