Last active
May 25, 2016 12:19
-
-
Save despairblue/67e65fbb6d5a6a45545fce7f44148722 to your computer and use it in GitHub Desktop.
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 characters
| const moment = require('moment') | |
| const dateStringWOTimeZone = '2016-05-29' | |
| const newDate = new Date(dateStringWOTimeZone).toISOString() | |
| const momentDate = moment(dateStringWOTimeZone).toISOString() | |
| const momentUTCDate = moment.utc(dateStringWOTimeZone).toISOString() | |
| const momentFromDate = moment(new Date(dateStringWOTimeZone)).toISOString() | |
| console.log(` | |
| ${newDate} = new Date('${dateStringWOTimeZone}').toISOString() | |
| ${momentDate} = moment('${dateStringWOTimeZone}').toISOString() | |
| ${momentUTCDate} = moment.utc('${dateStringWOTimeZone}').toISOString() | |
| ${momentFromDate} = moment(new Date('${dateStringWOTimeZone}')).toISOString() | |
| Run this file on the server: | |
| const moment = require('moment') | |
| console.log((new Date('${newDate}')).toISOString() + " = new Date('${newDate}')") | |
| console.log(moment('${momentDate}').toISOString() + " = moment('${momentDate}')") | |
| console.log(moment.utc('${momentUTCDate}').toISOString() + " = moment.utc('${momentUTCDate}')") | |
| console.log(moment(new Date('${momentFromDate}')).toISOString() + " = moment(new Date('${momentFromDate}'))") | |
| `) |
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 characters
| 2016-05-29T00:00:00.000Z = new Date('2016-05-29').toISOString() | |
| 2016-05-28T22:00:00.000Z = moment('2016-05-29').toISOString() | |
| 2016-05-29T00:00:00.000Z = moment.utc('2016-05-29').toISOString() | |
| 2016-05-29T00:00:00.000Z = moment(new Date('2016-05-29')).toISOString() |
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 characters
| 2016-05-29T00:00:00.000Z = new Date('2016-05-29T00:00:00.000Z') | |
| 2016-05-28T22:00:00.000Z = moment('2016-05-28T22:00:00.000Z') | |
| 2016-05-29T00:00:00.000Z = moment.utc('2016-05-29T00:00:00.000Z') | |
| 2016-05-29T00:00:00.000Z = moment(new Date('2016-05-29T00:00:00.000Z')) |
Author
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

moment()hat sich disqualifiziert