Skip to content

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

─── unset ───
─── unset ───
─── unset ───
─── unset ───
numeric
short
numeric
─── unset ───
numeric
numeric
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
LocaleLocalized value
en-US  American English3/23/2025
fr-FR  French (France)23/03/2025
de-DE  German (Germany)23.3.2025
fi-FI  Finnish (Finland)23.3.2025
sv-FI  Swedish (Finland)2025-03-23
ko-KR  Korean (South Korea)2025. 3. 23.
hi-IN  Hindi (India)23/3/2025

See also