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

NameTypeDescription
dateDateTimeDate to format.
localestringOptional locale override.

Returns

A localized time string containing hour and minute.

Type signature

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

All packages are released under the MIT License.