Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 5, 2018 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/87b403dd85e2d574ac0693aaa9ad7c88 to your computer and use it in GitHub Desktop.
Save productioncoder/87b403dd85e2d574ac0693aaa9ad7c88 to your computer and use it in GitHub Desktop.
Parsing an ISO 8601 date string in Javascript
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