Moment.js を使用しても、正しいモーメント オブジェクトをタイムゾーン付きの日付オブジェクトに変換できません。正しい日付を取得できません。
例:
var oldDate = new Date(),
momentObj = moment(oldDate).tz("MST7MDT"),
newDate = momentObj.toDate();
console.log("start date " + oldDate)
console.log("Format from moment with offset " + momentObj.format())
console.log("Format from moment without offset " + momentObj.utc().format())
console.log("(Date object) Time with offset " + newDate)
console.log("(Date object) Time without offset "+ moment.utc(newDate).toDate())
ベストアンサー1
これを使用して、瞬間オブジェクトを日付オブジェクトに変換します。
からhttp://momentjs.com/docs/#/displaying/as-javascript-date/
moment().toDate();
収量:
Tue Nov 04 2014 14:04:01 GMT-0600 (CST)