According to the MDN documentation for Date.toLocaleString(), the second parameter is an options parameter:
toLocaleString(locales, options)
Which they use in an example:
let date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
// Request a weekday along with a long date
let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
console.log(date.toLocaleString('de-DE', options));
My question is, what are the possible properties for the options parameter?
It's the same as those for the Intl.DateTimeFormat() constructor, whose MDN documentation provides a list of each valid property and an explanation.
The possible properties are as follows:
dateStyletimeStylecalendardayPeriodnumberingSystemlocaleMatchertimeZonehour12hourCycleformatMatcherweekdayerayearmonthdayhourminutesecondfractionalSecondDigitstimeZoneNameIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With