Last active
October 28, 2021 17:52
-
-
Save goofballLogic/d838cd14b54f87e1736321a884d7b0b8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 fullFormat = new Intl.DateTimeFormat("en", { dateStyle: "full" }); | |
const now = new Date(); | |
fullFormat.format(now); | |
// Thursday, October 28, 2021 | |
fullFormat.formatToParts(now) | |
/* | |
[ | |
{ | |
"type": "weekday", | |
"value": "Thursday" | |
}, | |
{ | |
"type": "literal", | |
"value": ", " | |
}, | |
{ | |
"type": "month", | |
"value": "October" | |
}, | |
{ | |
"type": "literal", | |
"value": " " | |
}, | |
{ | |
"type": "day", | |
"value": "28" | |
}, | |
{ | |
"type": "literal", | |
"value": ", " | |
}, | |
{ | |
"type": "year", | |
"value": "2021" | |
} | |
] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment