date-and-time 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/PLUGINS.md +22 -22
  2. package/README.md +81 -80
  3. package/date-and-time.d.ts +304 -0
  4. package/date-and-time.js +73 -72
  5. package/esm/date-and-time.es.js +73 -72
  6. package/esm/date-and-time.mjs +73 -72
  7. package/esm/plugin/timezone.es.js +1 -1
  8. package/esm/plugin/timezone.mjs +1 -1
  9. package/locale/ar.d.ts +1 -0
  10. package/locale/az.d.ts +1 -0
  11. package/locale/bn.d.ts +1 -0
  12. package/locale/cs.d.ts +1 -0
  13. package/locale/de.d.ts +1 -0
  14. package/locale/dk.d.ts +1 -0
  15. package/locale/el.d.ts +1 -0
  16. package/locale/en.d.ts +1 -0
  17. package/locale/es.d.ts +1 -0
  18. package/locale/fa.d.ts +1 -0
  19. package/locale/fr.d.ts +1 -0
  20. package/locale/hi.d.ts +1 -0
  21. package/locale/hu.d.ts +1 -0
  22. package/locale/id.d.ts +1 -0
  23. package/locale/it.d.ts +1 -0
  24. package/locale/ja.d.ts +1 -0
  25. package/locale/jv.d.ts +1 -0
  26. package/locale/ko.d.ts +1 -0
  27. package/locale/my.d.ts +1 -0
  28. package/locale/nl.d.ts +1 -0
  29. package/locale/pa-in.d.ts +1 -0
  30. package/locale/pl.d.ts +1 -0
  31. package/locale/pt.d.ts +1 -0
  32. package/locale/ro.d.ts +1 -0
  33. package/locale/ru.d.ts +1 -0
  34. package/locale/rw.d.ts +1 -0
  35. package/locale/sr.d.ts +1 -0
  36. package/locale/sv.d.ts +1 -0
  37. package/locale/th.d.ts +1 -0
  38. package/locale/tr.d.ts +1 -0
  39. package/locale/uk.d.ts +1 -0
  40. package/locale/uz.d.ts +1 -0
  41. package/locale/vi.d.ts +1 -0
  42. package/locale/zh-cn.d.ts +1 -0
  43. package/locale/zh-tw.d.ts +1 -0
  44. package/package.json +6 -3
  45. package/plugin/day-of-week.d.ts +1 -0
  46. package/plugin/meridiem.d.ts +1 -0
  47. package/plugin/microsecond.d.ts +1 -0
  48. package/plugin/ordinal.d.ts +1 -0
  49. package/plugin/timespan.d.ts +24 -0
  50. package/plugin/timezone.d.ts +79 -0
  51. package/plugin/timezone.js +1 -1
  52. package/plugin/two-digit-year.d.ts +1 -0
package/PLUGINS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Plugins
2
2
 
3
- This library is oriented towards minimalism, so it may seem to some developers to be lacking in features. Plugin is the most realistic solution to such dissatisfaction. By importing plugins, you can extend the functionality of this library, mainly a formatter and a parser.
3
+ This library is oriented towards minimalism, so it may seem to some developers to be lacking in features. The plugin is the most realistic solution to such dissatisfaction. By importing plugins, you can extend the functionality of this library, primarily the formatter and parser.
4
4
 
5
5
  *The formatter is used in `format()`, etc., the parser is used in `parse()`, `preparse()`, `isValid()`, etc.*
6
6
 
@@ -238,9 +238,9 @@ It adds `timeSpan()` function that calculates the difference of two dates to the
238
238
 
239
239
  #### timeSpan(date1, date2)
240
240
 
241
- - @param {**Date**} date1 - a Date object
242
- - @param {**Date**} date2 - a Date object
243
- - @returns {**Object**} a result object subtracting date2 from date1
241
+ - @param {**Date**} date1 - A Date object
242
+ - @param {**Date**} date2 - A Date object
243
+ - @returns {**Object**} The result object of subtracting date2 from date1
244
244
 
245
245
  ```javascript
246
246
  const date = require('date-and-time');
@@ -262,11 +262,11 @@ Like `subtract()`, `timeSpan()` returns an object with functions like this:
262
262
 
263
263
  | function | description |
264
264
  |:---------------|:------------------------|
265
- | toDays | Outputs as dates |
266
- | toHours | Outputs as hours |
267
- | toMinutes | Outputs as minutes |
268
- | toSeconds | Outputs as seconds |
269
- | toMilliseconds | Outputs as milliseconds |
265
+ | toDays | Outputs in dates |
266
+ | toHours | Outputs in hours |
267
+ | toMinutes | Outputs in minutes |
268
+ | toSeconds | Outputs in seconds |
269
+ | toMilliseconds | Outputs in milliseconds |
270
270
 
271
271
  In these functions can be available some tokens to format the calculation result. Here are the tokens and their meanings:
272
272
 
@@ -294,29 +294,29 @@ It adds `formatTZ()`, `parseTZ()` and `transformTZ()` that support `IANA time zo
294
294
 
295
295
  #### formatTZ(dateObj, arg[, timeZone])
296
296
 
297
- - @param {**Date**} dateObj - a Date object
298
- - @param {**string|Array.\<string\>**} arg - a format string or its compiled object
299
- - @param {**string**} [timeZone] - output as this time zone
300
- - @returns {**string**} a formatted string
297
+ - @param {**Date**} dateObj - A Date object
298
+ - @param {**string|Array.\<string\>**} arg - A format string or its compiled object
299
+ - @param {**string**} [timeZone] - Output as this time zone
300
+ - @returns {**string**} A formatted string
301
301
 
302
302
  `formatTZ()` is upward compatible with `format()`. Tokens available for `arg` are the same as those for `format()`. If `timeZone` is omitted, this function assumes `timeZone` to be a local time zone and outputs a string. This means that the result is the same as when `format()` is used.
303
303
 
304
304
  #### parseTZ(dateString, arg[, timeZone])
305
305
 
306
- - @param {**string**} dateString - a date string
307
- - @param {**string|Array.\<string\>**} arg - a format string or its compiled object
308
- - @param {**string**} [timeZone] - input as this time zone
309
- - @returns {**Date**} a constructed date
306
+ - @param {**string**} dateString - A date and time string
307
+ - @param {**string|Array.\<string\>**} arg - A format string or its compiled object
308
+ - @param {**string**} [timeZone] - Input as this time zone
309
+ - @returns {**Date**} A Date object
310
310
 
311
311
  `parseTZ()` is upward compatible with `parse()`. Tokens available for `arg` are the same as those for `parse()`. `timeZone` in this function is used as supplemental information. if `dateString` contains a time zone offset value (i.e. -0800, +0900), `timeZone` is not be used. If `dateString` doesn't contain a time zone offset value and `timeZone` is omitted, this function assumes `timeZone` to be a local time zone. This means that the result is the same as when `parse()` is used.
312
312
 
313
313
  #### transformTZ(dateString, arg1, arg2[, timeZone])
314
314
 
315
- - @param {**string**} dateString - a date string
316
- - @param {**string|Array.\<string\>**} arg1 - a format string or its compiled object
317
- - @param {**string|Array.\<string\>**} arg2 - a transformed format string or its compiled object
318
- - @param {**string**} [timeZone] - output as this time zone
319
- - @returns {**string**} a formatted string
315
+ - @param {**string**} dateString - A date and time string
316
+ - @param {**string|Array.\<string\>**} arg1 - A format string before transformation or its compiled object
317
+ - @param {**string|Array.\<string\>**} arg2 - A format string after transformation or its compiled object
318
+ - @param {**string**} [timeZone] - Output as this time zone
319
+ - @returns {**string**} A formatted string
320
320
 
321
321
  `transformTZ()` is upward compatible with `transform()`. `dateString` must itself contain a time zone offset value (i.e. -0800, +0900), otherwise this function assumes it is a local time zone. Tokens available for `arg1` are the same as those for `parse()`, also tokens available for `arg2` are the same as those for `format()`. `timeZone` is a `IANA time zone names`, which is required to output a new formatted string. If it is omitted, this function assumes `timeZone` to be a local time zone. This means that the result is the same as when `transform()` is used.
322
322
 
package/README.md CHANGED
@@ -24,16 +24,17 @@ npm i date-and-time
24
24
 
25
25
  ## Recent Changes
26
26
 
27
+ - 2.3.0
28
+ - TypeScript support.
29
+ - Fixed an issue where `parseTZ()` in timezone plugin could return `NaN` instead of `Invalid Date` if parsing failed.
30
+
27
31
  - 2.2.1
28
- - Fixed an issue where `parse()` would treat a date-time string containing a UTC time zone (i.e. +0000) as a local time zone when parsing it.
32
+ - Fixed an issue where `parse()` would treat a date and time string containing a UTC time zone (i.e. +0000) as a local time zone when parsing.
29
33
 
30
34
  - 2.2.0
31
35
  - Added `tranformTZ()` to `timezone` plugin. See [PLUGINS.md](./PLUGINS.md) for details.
32
36
  - Added `ZZ` token to support time zone values with colon like `-08:00` `+09:00` to `format()` and `parse()`.
33
37
 
34
- - 2.1.2
35
- - Fixed an issue where the lib's validation logic would consider an error when a time zone offset value of a date-time string was greater than +12 hours.
36
-
37
38
  ## Usage
38
39
 
39
40
  - ES Modules:
@@ -59,32 +60,34 @@ import date from '/path/to/date-and-time.es.min.js';
59
60
  - Older browser:
60
61
 
61
62
  ```html
62
- <script src="/path/to/date-and-time.min.js"></script>
63
+ <script src="/path/to/date-and-time.min.js">
64
+ // You will be able to access the global variable `date`.
65
+ </script>
63
66
  ```
64
67
 
65
68
  ### Note
66
69
 
67
- - If you want to use ES Modules in Node.js without a transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.
70
+ - If you want to use ES Modules in Node.js without the transpiler, you need to add `"type": "module"` in your `package.json` or change your file extension from `.js` to `.mjs`.
68
71
 
69
72
  ## API
70
73
 
71
74
  - [format](#formatdateobj-arg-utc)
72
- - Formatting a Date and Time (Date -> String)
75
+ - Formatting date and time objects (Date -> String)
73
76
 
74
77
  - [parse](#parsedatestring-arg-utc)
75
- - Parsing a Date and Time string (String -> Date)
78
+ - Parsing date and time strings (String -> Date)
76
79
 
77
80
  - [compile](#compileformatstring)
78
- - Compiling a format string
81
+ - Compiling format strings
79
82
 
80
83
  - [preparse](#preparsedatestring-arg)
81
- - Pre-parsing a Date and Time string
84
+ - Pre-parsing date and time strings
82
85
 
83
86
  - [isValid](#isvalidarg1-arg2)
84
- - Validation
87
+ - Date and time string validation
85
88
 
86
89
  - [transform](#transformdatestring-arg1-arg2-utc)
87
- - Transforming a Date and Time string (String -> String)
90
+ - Format transformation of date and time strings (String -> String)
88
91
 
89
92
  - [addYears](#addyearsdateobj-years)
90
93
  - Adding years
@@ -108,29 +111,29 @@ import date from '/path/to/date-and-time.es.min.js';
108
111
  - Adding milliseconds
109
112
 
110
113
  - [subtract](#subtractdate1-date2)
111
- - Subtracting two dates
114
+ - Subtracting two dates (date1 - date2)
112
115
 
113
116
  - [isLeapYear](#isleapyeary)
114
- - Whether year is leap year
117
+ - Whether a year is a leap year
115
118
 
116
119
  - [isSameDay](#issamedaydate1-date2)
117
120
  - Comparison of two dates
118
121
 
119
- - [locale](#localecode-locale)
120
- - Changing the locale or defining new locales
122
+ - [locale](#localelocale)
123
+ - Changing locales
121
124
 
122
125
  - [extend](#extendextension)
123
- - Feature extension
126
+ - Functional extension
124
127
 
125
- - [plugin](#pluginname-plugin)
126
- - Importing or defining plugins
128
+ - [plugin](#pluginplugin)
129
+ - Importing plugins
127
130
 
128
131
  ### format(dateObj, arg[, utc])
129
132
 
130
- - @param {**Date**} dateObj - a Date object
131
- - @param {**string|Array.\<string\>**} arg - a format string or its compiled object
132
- - @param {**boolean**} [utc] - output as UTC
133
- - @returns {**string**} a formatted string
133
+ - @param {**Date**} dateObj - A Date object
134
+ - @param {**string|Array.\<string\>**} arg - A format string or its compiled object
135
+ - @param {**boolean**} [utc] - Output as UTC
136
+ - @returns {**string**} A formatted string
134
137
 
135
138
  ```javascript
136
139
  const now = new Date();
@@ -194,7 +197,7 @@ date.format(new Date(), '[DD-[MM]-YYYY]'); // => 'DD-[MM]-YYYY'
194
197
 
195
198
  #### Note 2. Output as UTC
196
199
 
197
- This function usually outputs a local date-time string. Set to true the `utc` option (the 3rd parameter) if you would like to get a UTC date-time string.
200
+ This function usually outputs a local date and time string. Set to true the `utc` option (the 3rd parameter) if you would like to get a UTC date and time string.
198
201
 
199
202
  ```javascript
200
203
  date.format(new Date(), 'hh:mm A [GMT]Z'); // => '11:14 PM GMT-0800'
@@ -207,10 +210,10 @@ You can also define your own tokens. See [EXTEND.md](./EXTEND.md) for details.
207
210
 
208
211
  ### parse(dateString, arg[, utc])
209
212
 
210
- - @param {**string**} dateString - a date string
211
- - @param {**string|Array.\<string\>**} arg - a format string or its compiled object
212
- - @param {**boolean**} [utc] - input as UTC
213
- - @returns {**Date**} a constructed date
213
+ - @param {**string**} dateString - A date and time string
214
+ - @param {**string|Array.\<string\>**} arg - A format string or its compiled object
215
+ - @param {**boolean**} [utc] - Input as UTC
216
+ - @returns {**Date**} A Date object
214
217
 
215
218
  ```javascript
216
219
  date.parse('2015/01/02 23:14:05', 'YYYY/MM/DD HH:mm:ss'); // => Jan 2 2015 23:14:05 GMT-0800
@@ -278,7 +281,7 @@ if (isNaN(today)) {
278
281
 
279
282
  #### Note 2. Input as UTC
280
283
 
281
- This function assumes the `dateString` is a local date-time unless it contains a time zone offset value. Set to true the `utc` option (the 3rd parameter) if it is a UTC date-time.
284
+ This function assumes the `dateString` is a local datea and time unless it contains a time zone offset value. Set to true the `utc` option (the 3rd parameter) if it is a UTC date and time.
282
285
 
283
286
  ```javascript
284
287
  date.parse('11:14:05 PM', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800
@@ -317,7 +320,7 @@ date.parse('11:14:05 PM', 'hh:mm:ss A'); // => Jan 1 1970 23:14:05 GMT-0800
317
320
 
318
321
  #### Note 6. Token disablement
319
322
 
320
- Use square brackets `[]` if a date-time string includes some token characters. Tokens inside square brackets in the `formatString` will be interpreted as normal characters:
323
+ Use square brackets `[]` if a datea and time string includes some token characters. Tokens inside square brackets in the `formatString` will be interpreted as normal characters:
321
324
 
322
325
  ```javascript
323
326
  date.parse('12 hours 34 minutes', 'HH hours mm minutes'); // => Invalid Date
@@ -345,8 +348,8 @@ date.parse('2015/01/02 11:14:05', 'YYYY/MM/DD...'); // => Jan 2 2015 00:00:00
345
348
 
346
349
  ### compile(formatString)
347
350
 
348
- - @param {**string**} formatString - a format string
349
- - @returns {**Array.\<string\>**} a compiled object
351
+ - @param {**string**} formatString - A format string
352
+ - @returns {**Array.\<string\>**} A compiled object
350
353
 
351
354
  If you are going to execute the `format()`, the `parse()` or the `isValid()` so many times with one string format, recommended to precompile and reuse it for performance.
352
355
 
@@ -362,9 +365,9 @@ If you are going to execute the `format()`, the `parse()` or the `isValid()` so
362
365
 
363
366
  ### preparse(dateString, arg)
364
367
 
365
- - @param {**string**} dateString - a date string
366
- - @param {**string|Array.\<string\>**} arg - a format string or its compiled object
367
- - @returns {**Object**} a date structure
368
+ - @param {**string**} dateString - A date and time string
369
+ - @param {**string|Array.\<string\>**} arg - A format string or its compiled object
370
+ - @returns {**Object**} A pre-parsed result object
368
371
 
369
372
  This function takes exactly the same parameters with the `parse()`, but returns a date structure as follows unlike that:
370
373
 
@@ -392,9 +395,9 @@ This date structure provides a parsing result. You will be able to tell from it
392
395
 
393
396
  ### isValid(arg1[, arg2])
394
397
 
395
- - @param {**Object|string**} arg1 - a date structure or a date string
396
- - @param {**string|Array.\<string\>**} [arg2] - a format string or its compiled object
397
- - @returns {**boolean**} whether the date string is a valid date
398
+ - @param {**Object|string**} arg1 - A pre-parsed result object or a date and time string
399
+ - @param {**string|Array.\<string\>**} [arg2] - A format string or its compiled object
400
+ - @returns {**boolean**} Whether the date and time string is a valid date and time
398
401
 
399
402
  This function takes either exactly the same parameters with the `parse()` or a date structure which the `preparse()` returns, evaluates the validity of them.
400
403
 
@@ -410,11 +413,11 @@ date.isValid(result); // => true
410
413
 
411
414
  ### transform(dateString, arg1, arg2[, utc])
412
415
 
413
- - @param {**string**} dateString - a date string
414
- - @param {**string|Array.\<string\>**} arg1 - a format string or its compiled object
415
- - @param {**string|Array.\<string\>**} arg2 - a transformed format string or its compiled object
416
- - @param {**boolean**} [utc] - output as UTC
417
- - @returns {**string**} a formatted string
416
+ - @param {**string**} dateString - A date and time string
417
+ - @param {**string|Array.\<string\>**} arg1 - A format string or its compiled object before transformation
418
+ - @param {**string|Array.\<string\>**} arg2 - A format string or its compiled object after transformation
419
+ - @param {**boolean**} [utc] - Output as UTC
420
+ - @returns {**string**} A formatted string
418
421
 
419
422
  This function transforms the format of a date string. The 2nd parameter, `arg1`, is the format string of it. Available token list is equal to the `parse()`'s. The 3rd parameter, `arg2`, is the transformed format string. Available token list is equal to the `format()`'s.
420
423
 
@@ -428,9 +431,9 @@ date.transform('13:05', 'HH:mm', 'hh:mm A');
428
431
 
429
432
  ### addYears(dateObj, years)
430
433
 
431
- - @param {**Date**} dateObj - a Date object
432
- - @param {**number**} years - number of years to add
433
- - @returns {**Date**} a date after adding the value
434
+ - @param {**Date**} dateObj - A Date object
435
+ - @param {**number**} years - Number of years to add
436
+ - @returns {**Date**} The Date object after adding the value
434
437
 
435
438
  ```javascript
436
439
  const now = new Date();
@@ -439,9 +442,9 @@ const next_year = date.addYears(now, 1);
439
442
 
440
443
  ### addMonths(dateObj, months)
441
444
 
442
- - @param {**Date**} dateObj - a Date object
443
- - @param {**number**} months - number of months to add
444
- - @returns {**Date**} a date after adding the value
445
+ - @param {**Date**} dateObj - A Date object
446
+ - @param {**number**} months - Number of months to add
447
+ - @returns {**Date**} The Date object after adding the value
445
448
 
446
449
  ```javascript
447
450
  const now = new Date();
@@ -450,9 +453,9 @@ const next_month = date.addMonths(now, 1);
450
453
 
451
454
  ### addDays(dateObj, days)
452
455
 
453
- - @param {**Date**} dateObj - a Date object
454
- - @param {**number**} days - number of days to add
455
- - @returns {**Date**} a date after adding the value
456
+ - @param {**Date**} dateObj - A Date object
457
+ - @param {**number**} days - Number of days to add
458
+ - @returns {**Date**} The Date object after adding the value
456
459
 
457
460
  ```javascript
458
461
  const now = new Date();
@@ -461,9 +464,9 @@ const yesterday = date.addDays(now, -1);
461
464
 
462
465
  ### addHours(dateObj, hours)
463
466
 
464
- - @param {**Date**} dateObj - a Date object
465
- - @param {**number**} hours - number of hours to add
466
- - @returns {**Date**} a date after adding the value
467
+ - @param {**Date**} dateObj - A Date object
468
+ - @param {**number**} hours - Number of hours to add
469
+ - @returns {**Date**} The Date object after adding the value
467
470
 
468
471
  ```javascript
469
472
  const now = new Date();
@@ -472,9 +475,9 @@ const an_hour_ago = date.addHours(now, -1);
472
475
 
473
476
  ### addMinutes(dateObj, minutes)
474
477
 
475
- - @param {**Date**} dateObj - a Date object
476
- - @param {**number**} minutes - number of minutes to add
477
- - @returns {**Date**} a date after adding the value
478
+ - @param {**Date**} dateObj - A Date object
479
+ - @param {**number**} minutes - Number of minutes to add
480
+ - @returns {**Date**} The Date object after adding the value
478
481
 
479
482
  ```javascript
480
483
  const now = new Date();
@@ -483,9 +486,9 @@ const two_minutes_later = date.addMinutes(now, 2);
483
486
 
484
487
  ### addSeconds(dateObj, seconds)
485
488
 
486
- - @param {**Date**} dateObj - a Date object
487
- - @param {**number**} seconds - number of seconds to add
488
- - @returns {**Date**} a date after adding the value
489
+ - @param {**Date**} dateObj - A Date object
490
+ - @param {**number**} seconds - Number of seconds to add
491
+ - @returns {**Date**} The Date object after adding the value
489
492
 
490
493
  ```javascript
491
494
  const now = new Date();
@@ -494,9 +497,9 @@ const three_seconds_ago = date.addSeconds(now, -3);
494
497
 
495
498
  ### addMilliseconds(dateObj, milliseconds)
496
499
 
497
- - @param {**Date**} dateObj - a Date object
498
- - @param {**number**} milliseconds - number of milliseconds to add
499
- - @returns {**Date**} a date after adding the value
500
+ - @param {**Date**} dateObj - A Date object
501
+ - @param {**number**} milliseconds - Number of milliseconds to add
502
+ - @returns {**Date**} The Date object after adding the value
500
503
 
501
504
  ```javascript
502
505
  const now = new Date();
@@ -505,9 +508,9 @@ const a_millisecond_later = date.addMilliseconds(now, 1);
505
508
 
506
509
  ### subtract(date1, date2)
507
510
 
508
- - @param {**Date**} date1 - a Date object
509
- - @param {**Date**} date2 - a Date object
510
- - @returns {**Object**} a result object subtracting date2 from date1
511
+ - @param {**Date**} date1 - A Date object
512
+ - @param {**Date**} date2 - A Date object
513
+ - @returns {**Object**} The result object of subtracting date2 from date1
511
514
 
512
515
  ```javascript
513
516
  const today = new Date(2015, 0, 2);
@@ -522,8 +525,8 @@ date.subtract(today, yesterday).toMilliseconds(); // => 86400000
522
525
 
523
526
  ### isLeapYear(y)
524
527
 
525
- - @param {**number**} y - year
526
- - @returns {**boolean**} whether year is leap year
528
+ - @param {**number**} y - A year to check
529
+ - @returns {**boolean**} Whether the year is a leap year
527
530
 
528
531
  ```javascript
529
532
  date.isLeapYear(2015); // => false
@@ -532,9 +535,9 @@ date.isLeapYear(2012); // => true
532
535
 
533
536
  ### isSameDay(date1, date2)
534
537
 
535
- - @param {**Date**} date1 - a Date object
536
- - @param {**Date**} date2 - a Date object
537
- - @returns {**boolean**} whether the two dates are the same day (time is ignored)
538
+ - @param {**Date**} date1 - A Date object
539
+ - @param {**Date**} date2 - A Date object
540
+ - @returns {**boolean**} Whether the two dates are the same day (time is ignored)
538
541
 
539
542
  ```javascript
540
543
  const date1 = new Date(2017, 0, 2, 0); // Jan 2 2017 00:00:00
@@ -544,11 +547,10 @@ date.isSameDay(date1, date2); // => true
544
547
  date.isSameDay(date1, date3); // => false
545
548
  ```
546
549
 
547
- ### locale([code[, locale]])
550
+ ### locale([locale])
548
551
 
549
- - @param {**Function|string**} [code] - locale installer | language code
550
- - @param {**Object**} [locale] - locale definition
551
- - @returns {**string**} current language code
552
+ - @param {**Function|string**} [locale] - A locale installer or language code
553
+ - @returns {**string**} The current language code
552
554
 
553
555
  It returns the current language code if called without any parameters.
554
556
 
@@ -568,15 +570,14 @@ See [LOCALE.md](./LOCALE.md) for details.
568
570
 
569
571
  ### extend(extension)
570
572
 
571
- - @param {**Object**} extension - extension object
573
+ - @param {**Object**} extension - An extension object
572
574
  - @returns {**void**}
573
575
 
574
576
  It extends this library. See [EXTEND.md](./EXTEND.md) for details.
575
577
 
576
- ### plugin(name[, plugin])
578
+ ### plugin(plugin)
577
579
 
578
- - @param {**Function|string**} name - plugin installer | plugin name
579
- - @param {**Object**} [plugin] - plugin object
580
+ - @param {**Function|string**} plugin - A plugin installer or plugin name
580
581
  - @returns {**void**}
581
582
 
582
583
  Plugin is a named extension object. By installing predefined plugins, you can easily extend this library. See [PLUGINS.md](./PLUGINS.md) for details.