js toLocaleDateString options values code example

Example 1: js toLocaleDateString options values

[[Weekday]]			"weekday"	"narrow", "short", "long"
[[Era]]				"era"	"narrow", "short", "long"
[[Year]]			"year"	"2-digit", "numeric"
[[Month]]			"month"	"2-digit", "numeric", "narrow", "short", "long"
[[Day]]				"day"	"2-digit", "numeric"
[[Hour]]			"hour"	"2-digit", "numeric"
[[Minute]]			"minute"	"2-digit", "numeric"
[[Second]]			"second"	"2-digit", "numeric"
[[TimeZoneName]]	"timeZoneName"	"short", "long"

/*

https://medium.com/swlh/use-tolocaledatestring-to-format-javascript-dates-2959108ea020
https://tc39.es/ecma402/#sec-datetimeformat-abstracts

*/

Example 2: toLocaleDateString() options

new Date("1983-March-25").toLocaleDateString('fr-CA', { year: 'numeric', month: '2-digit', day: '2-digit' })
'03/25/1983'