latest log

酩酊状態で書いたエンジニアポエムです。酩酊状態で読んでください。

うるう秒 と JavaScript の Date.parse

うるう秒を Date.parse 関数に与えるとどうなるのか?

  • 1998-12-31 23:59:60 (過去のうるう秒)
  • 2012-07-01 08:59:60 (今回のうるう秒)
  • 2012-07-01 08:59:59 (通常の秒)

の3パターンで調べました。

Browser type "Thu Dec 31 23:59:60 GMT 1998" "2012-07-01T08:59:60Z" "2012-07-01T08:59:59Z"
Android Browser (OS 2.3.4) v8 -283996860000 NaN (※) NaN (※)
Chrome for Android (OS 4.0.1) v8 -283996860000 NaN 1341133199000
Chrome dev (Windows 7) v8 -283996860000 NaN 1341133199000
Chrome for iOS (iOS 5.1.1) JavaScriptCore NaN 1341133200000 1341133199000
node.js 0.6.17 (Windows 7) v8 -283996860000 NaN 1341133199000
Mobile Safari (iOS 5.1.1) JavaScriptCore NaN 1341133200000 1341133199000
Safari (Windows 7) JavaScriptCore NaN 1341133200000 1341133199000
IE 10 PP2 (Windows 7) IE NaN NaN 1341133199000
IE 9 (Windows 7) IE NaN NaN 1341133199000
IE 8 emu (Windows 7) IE NaN NaN (※) NaN (※)
IE 7 emu (Windows 7) IE NaN NaN (※) NaN (※)
Firefox for Android(OS 2.3.4) Gecko 915148800000 NaN 1341133199000
Firefox 13.0.1 (Windows 7) Gecko 915148800000 NaN 1341133199000
Opera 12 (Windows 7) Opera 915148800000 NaN 1341133199000

※ Date.parse が UTC Date String を解釈できないため NaN を返しています


(ε・◇・)з Chrome for iOS の中身は JavaScriptCore との事です