UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

24 lines (23 loc) 1.27 kB
import type { LocaleNameStyle } from "./getLocaleMonthNames.js"; /** * Return a locale's Gregorian era names as [BCE-label, CE-label]. * * - The two-element array is [Before Common Era label, Common Era label]. * - Uses the host runtime's `Intl` data via `Intl.DateTimeFormat`, so output * depends on the runtime's ICU build (full-ICU runtimes localize every * locale; partial-ICU runtimes fall back to English). * - If a locale has no distinct BCE/CE era names, both array elements * contain the same string — the function never returns a sentinel for * a valid locale, only for invalid input. * - Returns `[]` if `locale` is not a valid BCP 47 tag. * * @param locale BCP 47 locale tag (e.g. "en-US", "fr-FR", "ar-SA") * @param style Optional name style: `"long"` (default), `"short"`, or `"narrow"` * @returns 2-element `[BCE-label, CE-label]` array, or `[]` on invalid input * * @example getLocaleEraNames("en-US") // ["Before Christ", "Anno Domini"] * @example getLocaleEraNames("de-DE", "short") // ["v. Chr.", "n. Chr."] * @example getLocaleEraNames("ja-JP", "narrow") // ["BC", "AD"] * @example getLocaleEraNames("not-a-locale") // [] */ export declare function getLocaleEraNames(locale: string, style?: LocaleNameStyle): string[];