With Node 16, `Intl.DateTimeFormatOptions` seems to no longer honor the `dayPeriod` option and always return the "long" version, so fallback to use the `timeStyle` option if needed
// For some reason the Intl.DateTimeFormat doesn't honor the `dayPeriod` value and always returns the long version, so use the "short" timeStyle instead
constdayPeriod=getTimeFormatter('short')
.formatToParts(date)
.find(p=>p.type==='dayPeriod');
return`${(dayPeriod??part)?.value??''}`;
}
returnpart?.value??'';
}
@ -300,6 +329,7 @@ function getDateTimeFormatOptionsFromFormatString(