Skip to content

formatMonth

Formats the month from a Luxon DateTime. Pass false for isLong when a compact UI needs abbreviated month names.

Importing

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

Usage

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

const month = formatMonth(DateTime.fromISO('2026-05-20'), false, 'en');

// 'May'

Parameters

date: DateTime
Date to format.

isLong: boolean
Use long month names when true; short names when false.
Default: true

locale?: string
Locale override.

Returns

A localized month name. When isLong is true, the long month form is used; when false, the short form is used.

Type signature

ts
declare function formatMonth(
    date: DateTime,
    isLong: boolean,
    locale?: string
): string;

All packages are released under the MIT License.