Skip to content

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

LocaleLocalized value
en-US  American English3/23/2025, 9:40:35 AM – 9:59:00 AM
fr-FR  French (France)23/03/2025, 09:40:35 – 09:59:00
de-DE  German (Germany)23.3.2025, 09:40:35 – 09:59:00
fi-FI  Finnish (Finland)23.3.2025 9.40.35–9.59.00
sv-FI  Swedish (Finland)2025-03-23 09.40.35 – 09.59.00
ko-KR  Korean (South Korea)2025. 3. 23. 오전 9:40:35 ~ 오전 9:59:00
hi-IN  Hindi (India)23/3/2025, 9:40:35 am – 9:59:00 am

See also