Created
September 24, 2019 10:30
-
-
Save jakangah/9d2993dbf3511f2e8d512aff5f460dfd to your computer and use it in GitHub Desktop.
convert date to array
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
'use strict'; | |
exports.dateToArray = date => { | |
date = date.getUTCDate ? date : new Date(date); | |
return [ | |
date.getUTCFullYear(), | |
date.getUTCMonth() + 1, | |
date.getUTCDate(), | |
date.getUTCHours(), | |
date.getUTCMinutes(), | |
date.getUTCSeconds() | |
]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment