diff options
| author | ST-DDT <[email protected]> | 2022-02-01 17:31:52 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-02-01 17:31:52 +0100 |
| commit | 5e6754da61b63019fd063fad26adbeeabd8b789b (patch) | |
| tree | 954f7730feba92d951f66862d9165b99645f8981 /src/definitions/date.ts | |
| parent | 18b4349af05ca671f1fc4cff0c04d359e914f001 (diff) | |
| download | faker-5e6754da61b63019fd063fad26adbeeabd8b789b.tar.xz faker-5e6754da61b63019fd063fad26adbeeabd8b789b.zip | |
feat(types): provide strong typing for locales (#363)
Diffstat (limited to 'src/definitions/date.ts')
| -rw-r--r-- | src/definitions/date.ts | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/definitions/date.ts b/src/definitions/date.ts new file mode 100644 index 00000000..2738bdb5 --- /dev/null +++ b/src/definitions/date.ts @@ -0,0 +1,44 @@ +import { allOf } from './utils'; + +/** + * The possible definitions related to dates. + */ +export interface DateDefinitions { + /** + * The translations for months (January - December). + */ + month: DateEntryDefinition; + /** + * The translations for weekdays (Sunday - Saturday). + */ + weekday: DateEntryDefinition; +} + +/** + * The possible definitions related to date entries. + */ +export interface DateEntryDefinition { + /** + * The long name of the entry. + */ + wide: string[]; + /** + * The short name/abbreviation of the entry. + */ + abbr: string[]; + /** + * The wide name of the entry when used in context. If absent wide will be used instead. + * It is used to specify a word in context, which may differ from a stand-alone word. + */ + wide_context?: string[]; + /** + * The short name/abbreviation name of the entry when used in context. If absent abbr will be used instead. + * It is used to specify a word in context, which may differ from a stand-alone word. + */ + abbr_context?: string[]; +} + +/** + * Internal: A list of all keys for the DateDefinitions. + */ +export const DATE = allOf<keyof DateDefinitions>()('month', 'weekday'); |
