Created
November 5, 2018 07:35
-
-
Save productioncoder/87b403dd85e2d574ac0693aaa9ad7c88 to your computer and use it in GitHub Desktop.
Parsing an ISO 8601 date string in Javascript
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
export function getPublishedAtDateString(iso8601DateString) { | |
if (!iso8601DateString) { | |
return ''; | |
} | |
const date = new Date(Date.parse(iso8601DateString)); | |
return date.toDateString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment