vue-i18n / general / ComposerDateTimeFormatting
Interface: ComposerDateTimeFormatting()<DateTimeFormats, Locales, DefinedDateTimeFormat, C, M, ResourceKeys>
Vue I18n Composition
Datetime formatting functions
Remarks
This is the interface for Composer
Type Parameters
| Type Parameter | Default type |
|---|---|
DateTimeFormats extends Record<string, any> | object |
Locales | "en-US" |
DefinedDateTimeFormat extends RemovedIndexResources<DefineDateTimeFormat> | RemovedIndexResources<DefineDateTimeFormat> |
C | IsEmptyObject<DefinedDateTimeFormat> extends false ? PickupFormatPathKeys<{ [K in keyof DefinedDateTimeFormat]: DefinedDateTimeFormat[K] }> : never |
M | IsEmptyObject<DateTimeFormats> extends false ? PickupFormatKeys<DateTimeFormats> : never |
ResourceKeys extends C | M | IsNever<C> extends false ? IsNever<M> extends false ? C | M : C : IsNever<M> extends false ? M : never |
Call Signature
ComposerDateTimeFormatting(value): string;Datetime formatting
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | number | Date | A value, timestamp number or Date instance or ISO 8601 string |
Returns
string
Formatted value
Remarks
If this is used in a reactive context, it will re-evaluate once the locale changes.
If UseI18nScope 'local' or Some UseI18nOptions are specified at useI18n, it’s translated in preferentially local scope datetime formats than global scope datetime formats.
If not, then it’s formatted with global scope datetime formats.
See about:
Call Signature
ComposerDateTimeFormatting<Value, Key, OptionsType>(value, keyOrOptions): IsPart<OptionsType> extends true ? DateTimeFormatPart[] : string;Datetime formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Value extends string | number | Date | number |
Key extends string | string |
OptionsType | | ResourceKeys | Key | DateTimeOptions<ResourceKeys | Key, Locales> |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | Value | A value, timestamp number or Date instance or ISO 8601 string |
keyOrOptions | OptionsType | A key of datetime formats, or additional options for datetime formatting |
Returns
IsPart<OptionsType> extends true ? DateTimeFormatPart[] : string
Formatted value
Remarks
Overloaded d.
In this overloaded d, format in datetime format for a key registered in datetime formats.
Call Signature
ComposerDateTimeFormatting<Value, Key, OptionsType>(
value,
keyOrOptions,
locale): IsPart<OptionsType> extends true ? DateTimeFormatPart[] : string;Datetime formatting
Type Parameters
| Type Parameter | Default type |
|---|---|
Value extends string | number | Date | number |
Key extends string | string |
OptionsType | | ResourceKeys | Key | DateTimeOptions<ResourceKeys | Key, Locales> |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | Value | A value, timestamp number or Date instance or ISO 8601 string |
keyOrOptions | OptionsType | A key of datetime formats, or additional options for datetime formatting |
locale | Locales | A locale, it will be used over than global scope or local scope. |
Returns
IsPart<OptionsType> extends true ? DateTimeFormatPart[] : string
Formatted value
Remarks
Overloaded d.
In this overloaded d, format in datetime format for a key registered in datetime formats at target locale