I would like to display three custom dropdowns for the user to select year, month, and day of their identification card.
How can I determine which order to show the year
function datePartOrder(locale) {
const parts = new Intl.DateTimeFormat(locale).formatToParts();
const filteredParts = parts.filter(part => ['year', 'month', 'day'].includes(part.type));
const filteredPartNames = filteredParts.map(part => part.type);
return filteredPartNames;
}
// examples:
console.log(datePartOrder('en-US')); //["month", "day", "year"] );
console.log(datePartOrder('en-CA')); //["year", "month", "day"]