Created
May 30, 2024 06:57
-
-
Save ryanmorr/9a89e87426d7a19574ffc025db45dce4 to your computer and use it in GitHub Desktop.
Format a date according to the user's language
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
// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/languages | |
const date = new Date("2012-05-24"); | |
const formattedDate = new Intl.DateTimeFormat(navigator.languages).format(date); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment