Date Style and Time Style Options
You'll learn how to use dateStyle and timeStyle shortcuts to format dates with pre-defined patterns instead of configuring every date/time component manually.
When working with Intl.DateTimeFormat, you can specify every detail (year format, month format, day format, etc.) individually—but that's tedious. The dateStyle and timeStyle options provide convenient shortcuts that apply culturally-appropriate preset patterns in one step.
The Four Preset Levels
Both dateStyle and timeStyle accept four values:
"full"– The most verbose format with maximum detail"long"– Detailed but slightly shorter"medium"– Balanced, commonly used default"short"– Minimal, compact format
These adapt automatically to the locale you're formatting for, so "full" in English looks different than "full" in Japanese.
How They Work
const date = new Date('2024-03-15T14:30:00');
// Date only
new Intl.DateTimeFormat('en-US', { dateStyle: 'full' }).format(date);
// "Friday, March 15, 2024"
new Intl.DateTimeFormat('en-US', { dateStyle: 'short' }).format(date);
// "3/15/24"
// Time only
new Intl.DateTimeFormat('en-US', { timeStyle: 'medium' }).format(date);
// "2:30:00 PM"
// Both together
new Intl.DateTimeFormat('en-US', {
dateStyle: 'long',
timeStyle: 'short'
}).format(date);
// "March 15, 2024 at 2:30 PM"
Important Constraint
You cannot mix dateStyle/timeStyle with individual component options like year, month, or hour. They're mutually exclusive—choose one approach or the other.
Key Takeaway: Use dateStyle and timeStyle as quick, locale-aware shortcuts for common date/time formats without manually specifying every component, choosing from full, long, medium, or short based on your UI needs.