getLocaleMeridiems
Signature
Section titled “Signature”getLocaleMeridiems(locale: string): string[]import { getLocaleMeridiems } from "@northguild/gmt/plain/locale";Return a locale’s AM/PM (day-period) labels as [AM-label, PM-label].
- Labels are locale-varying:
en-US→["AM", "PM"],en-GB→["am", "pm"],sv-SE→["fm", "em"],zh-CN→["上午", "下午"],ar-SA→["ص", "م"]. - Uses the host runtime’s
Intldata viaIntl.DateTimeFormat, so output depends on the runtime’s ICU build. - Returns
[]iflocaleis not a valid BCP 47 tag.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
locale |
string |
BCP 47 locale tag (e.g. “en-US”, “fr-FR”, “ar-SA”) |
Returns
Section titled “Returns”2-element [AM-label, PM-label] array, or [] on invalid input
Examples
Section titled “Examples”getLocaleMeridiems("en-US") // ["AM", "PM"]getLocaleMeridiems("en-GB") // ["am", "pm"]getLocaleMeridiems("zh-CN") // ["上午", "下午"]getLocaleMeridiems("not-a-locale") // []