Created
January 22, 2019 23:48
-
-
Save stwilz/29f226f2c5c7c61d2bca1c2b1d58645b to your computer and use it in GitHub Desktop.
This file contains 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 dateStringtoObj = string => { | |
const [date, time, timezone] = string.split(/T|\+/g); | |
const [hours, minutes, seconds] = time.split(/:/g); | |
return { | |
date, | |
time, | |
timezone, | |
hours: parseInt(hours, 10), | |
minutes: parseInt(minutes, 10), | |
seconds: parseInt(seconds, 10), | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment