ダッシュで区切られた日付で次のような行動を誰でも説明できますか?Javascriptの興味深い特質
console.log(new Date('2015/03/03'));
Tue Mar 03 2015 00:00:00 GMT+0000 (GMT Standard Time)
console.log(new Date('2015-03-03'));
Tue Mar 03 2015 00:00:00 GMT+0000 (GMT Standard Time)
console.log(new Date('2015/04/03'));
Fri Apr 03 2015 00:00:00 GMT+0100 (GMT Daylight Time)
console.log(new Date('2015-04-03'));
Fri Apr 03 2015 01:00:00 GMT+0100 (GMT Daylight Time) // This is the weird one
注:私はイギリスにいるので、冬はGMT + 0、夏はGMT + 1です。
注2:「/」をセパレータとして使用する必要があります。特にIE11はそうではありませんが、Chromeでどのように起こるのか不思議です。
注3:NodeJSではさらに怪我をします。
console.log(new Date('2015/03/03'));
2015-03-03T00:00:00.000Z
console.log(new Date('2015-03-03'));
2015-03-03T00:00:00.000Z
console.log(new Date('2015/04/03'));
2015-04-02T23:00:00.000Z //This is the weird one this time
console.log(new Date('2015-04-03'));
2015-04-03T00:00:00.000Z
8601は、1つの真のパスです。 [関連xkcd](https://xkcd.com/1179/) – cloudworks
@cloudworks ...どのECMAScriptが完全に従っていないのですか? : –
ありがとうございます。重複したリンクは本当に答えになります。 – Chexpir