-
Notifications
You must be signed in to change notification settings - Fork 4
Variable.resolveRelativeTimeFormat
kodiakhq[bot] edited this page Nov 1, 2025
·
34 revisions
@sumup-oss/intl / resolveRelativeTimeFormat
constresolveRelativeTimeFormat: (locales?,options?) =>ResolvedRelativeTimeFormatOptions|null
Defined in: lib/relative-time-format/index.ts:171
Resolves the locale and collation options that are used to format a relative time.
| Parameter | Type |
|---|---|
locales? |
string | string[] |
options? |
RelativeTimeFormatOptions |
ResolvedRelativeTimeFormatOptions | null
import { resolveRelativeTimeFormat } from '@sumup-oss/intl';
resolveRelativeTimeFormat('de-DE');
// {
// "locale": "de-DE",
// "numberingSystem": "latn",
// "numeric": "always",
// "style": "long",
// }
resolveRelativeTimeFormat(['pt-BR', 'pt']);
// {
// "locale": "pt-BR",
// "numberingSystem": "latn",
// "numeric": "always",
// "style": "long",
// }
resolveRelativeTimeFormat('en-GB', {
style: 'narrow',
});
// {
// "locale": "en-GB",
// "numberingSystem": "latn",
// "numeric": "always",
// "style": "narrow",
// }In runtimes that don't support the Intl.RelativeTimeFormat.resolvedOptions API,
null is returned.