dateTimeRange @localizer/format 1.1.3
The dateTimeRange
is used to format date and time ranges in a human-readable way. It takes two arguments representing the start and end of the range and returns a formatted string that clearly conveys the range.
Usage
typescript
import { dateTimeRange } from '@localizer/format';
const rangeStart = new Date(2025, 2, 23, 11, 40, 35);
const rangeEnd = new Date(2025, 2, 23, 12, 59, 0);
const result = dateTimeRange(rangeStart, rangeEnd);
Formatter accepts JavaScript Date objects or numbers, which are treated as timestamps (milliseconds since January 1, 1970, 00:00:00 UTC).
Demo
Locale | Localized value |
---|---|
en-US | 3/23/2025, 9:40:35 AM – 9:59:00 AM |
fr-FR | 23/03/2025, 09:40:35 – 09:59:00 |
de-DE | 23.3.2025, 09:40:35 – 09:59:00 |
fi-FI | 23.3.2025 9.40.35–9.59.00 |
sv-FI | 2025-03-23 09.40.35 – 09.59.00 |
ko-KR | 2025. 3. 23. 오전 9:40:35 ~ 오전 9:59:00 |
hi-IN | 23/3/2025, 9:40:35 am – 9:59:00 am |