Skip to content

formatTime ​

Formats hour and minute from a Luxon DateTime. Use it when the date is already clear from context and only the time should be displayed.

Importing ​

ts
import { formatTime } from '@almighty-shogun/utils';

Usage ​

ts
import { DateTime } from 'luxon';
import { formatTime } from '@almighty-shogun/utils';

const time = formatTime(DateTime.fromISO('2026-05-20T14:30:00'), 'en');

Parameters

date: DateTime
Date to format.

locale?: Undefinable<string>
Locale override.

Returns

A localized time string containing hour and minute.

Uses ​

Type signature ​

ts
declare function formatTime(
    date: DateTime,
    locale?: Undefinable<string>
): string;

All packages are released under the MIT License.