出于某种原因,当我将带有夏威夷时区的日期传递给 JavaScript 时,Date()
我得到“无效日期”,但任何其他时区都没有。有解决方法吗?
var HAST = 'Wed, 31 Jul 2013 07:21:16 HAST';
var hawaiiTime = new Date(HAST);
console.log("Hawaii time: "+hawaiiTime);
// Hawaii time: Invalid Date
var PST = 'Wed, 31 Jul 2013 07:21:16 PST';
var pacificTime = new Date(PST);
console.log("Pacific time: "+pacificTime);
// Pacific time: Wed Jul 31 2013 09:21:16 GMT-0600 (MDT)