Created
February 7, 2014 21:22
Revisions
-
nisaacson created this gist
Feb 7, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ // Denver ISO 8601 Offset // see https://github.com/moment/moment/issues/1422#issuecomment-32908589 var DEFAULT_TIMEZONE_OFFSET = '-07:00' var moment = require('moment') console.log(parseTime('2013-01-01T00:00:00-02:00')) console.log(parseTime('2013-01-01 00:00:00')); function parseTime(input) { var date = moment.parseZone(input) var zone = date.zone() if (zone === 0) { return date.zone(DEFAULT_TIMEZONE_OFFSET).toISOString() } return date.toISOString() }