Skip to content

Commit 78699a0

Browse files
committed
docs(dateFieldName): add API documentation for the method
1 parent 36e3e78 commit 78699a0

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

docs/cldr/api.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,55 @@ The names.
8686

8787
If the type is `"dayPeriods"` or `"eras"`, an object is returned. For the other types, the result is `Array`.
8888

89+
### dateFieldName
90+
91+
Returns a localized date field name based on a specific format specifier.
92+
93+
#### dateFieldName Parameters
94+
95+
##### options `Object`
96+
97+
The options that determine the returned date field name.
98+
99+
##### options.type `String`
100+
101+
The type of the date field name.
102+
103+
The supported values are:
104+
* `"era"`
105+
* `"year"`
106+
* `"quarter"`
107+
* `"month"`
108+
* `"week"`
109+
* `"day"`
110+
* `"weekday"`
111+
* `"dayperiod"`
112+
* `"hour"`
113+
* `"minute"`
114+
* `"second"`
115+
* `"zone"`
116+
117+
##### options.nameType `String`
118+
119+
The format name type.
120+
121+
The supported values are:
122+
* `"wide"`
123+
* `"narrow"`
124+
* `"short"`
125+
126+
##### locale `String`
127+
128+
The locale id.
129+
130+
#### dateFieldName Return Value
131+
132+
##### Returns `String`
133+
134+
The date field name.
135+
136+
If an information for the specified date field type is missing, a `undefined` is returned.
137+
89138
### numberSymbols
90139

91140
Returns the number symbols from the specified locale.

docs/cldr/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The following table provides the data formats that are required for number and d
2626
| Basic dates | `cldr/main/locale/ca-gregorian.json` |
2727
| Localized timezone | `cldr/main/locale/timeZoneNames.json` |
2828
| Numeric week day formatting | `cldr/supplemental/weekData.json` |
29+
| Localized date field names | `cldr/supplemental/dateFields.json` |
2930

3031
## Getting CLDR Data
3132

@@ -43,6 +44,7 @@ const numbers = require("cldr-data/main/bg/numbers.json");
4344
const timeZoneNames = require("cldr-data/main/bg/timeZoneNames.json");
4445
const calendar = require("cldr-data/main/bg/ca-gregorian.json");
4546
const currencies = require("cldr-data/main/bg/currencies.json");
47+
const currencies = require("cldr-data/main/bg/dateFields.json");
4648
const weekData = require("cldr-data/supplemental/weekData.json");
4749
const currencyData = require("cldr-data/supplemental/currencyData.json");
4850
@@ -53,6 +55,7 @@ load(
5355
numbers,
5456
currencies,
5557
calendar,
58+
dateFields,
5659
timeZoneNames
5760
);
5861

src/cldr.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export interface DateFieldNameOptions {
6262
/**
6363
* Returns a localized date field name based on a specific format specifier.
6464
*
65-
* @param formatSpecifier The dateFieldName options.
65+
* @param options The dateFieldName options.
6666
* @param locale The optional locale id. If not specified, the `"en"` locale id is used.
6767
* @returns The localized date field name determined by the dateFieldName options.
6868
*
@@ -74,7 +74,7 @@ export interface DateFieldNameOptions {
7474
* dateFieldName({ type: 'month', nameType: 'wide' }); //returns 'month';
7575
* ```
7676
*/
77-
export function dateFieldName(formatSpecifier: DateFieldNameOptions, locale?: string): string;
77+
export function dateFieldName(options: DateFieldNameOptions, locale?: string): string;
7878

7979
/**
8080
* Returns the first day index starting from Sunday based on the specified locale.

0 commit comments

Comments
 (0)