dateTimeRangeFormatter @localizer/format-datetime 1.1.1
The dateTimeRangeFormatter
provides a flexible way to format date and time ranges according to your specific requirements. It allows you to define custom formatting options, making it suitable for a variety of use cases where precise control over date and time presentation is needed.
Usage
typescript
import { dateTimeRangeFormatter } from '@localizer/format-datetime';
const formatter = dateTimeRangeFormatter({
month: 'short',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
year: 'numeric',
});
const rangeStart = new Date(2025, 2, 23, 11, 40, 35);
const rangeEnd = new Date(2025, 2, 23, 12, 59, 0);
const result = formatter(rangeStart, rangeEnd);
See formatter options for configuration details.
Demo
Locale | Localized value |
---|---|
en-US | 3/23/2025 |
fr-FR | 23/03/2025 |
de-DE | 23.3.2025 |
fi-FI | 23.3.2025 |
sv-FI | 2025-03-23 |
ko-KR | 2025. 3. 23. |
hi-IN | 23/3/2025 |