Skip to content

Instantly share code, notes, and snippets.

@kaesetoast
Created February 10, 2021 16:58
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 kaesetoast/c092271102ad785d3d9e8bee05a78e66 to your computer and use it in GitHub Desktop.
Save kaesetoast/c092271102ad785d3d9e8bee05a78e66 to your computer and use it in GitHub Desktop.
Example of using the Intl API to format a date
// output: 10.02.2021, 17:53
new Intl.DateTimeFormat('de-DE', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
}).format(new Date(comment.created_at));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment