@design-edito/tools 0.5.13 → 0.5.15

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 (62) hide show
  1. package/agnostic/colors/index.d.ts +1 -1
  2. package/agnostic/colors/index.js +1 -1
  3. package/agnostic/css/index.d.ts +2 -2
  4. package/agnostic/css/index.js +2 -2
  5. package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +14 -14
  6. package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +14 -14
  7. package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +3 -3
  8. package/agnostic/html/hyper-json/smart-tags/isolated/index.js +3 -3
  9. package/agnostic/html/index.d.ts +2 -2
  10. package/agnostic/html/index.js +2 -2
  11. package/agnostic/index.d.ts +2 -2
  12. package/agnostic/index.js +2 -2
  13. package/agnostic/misc/index.d.ts +3 -3
  14. package/agnostic/misc/index.js +3 -3
  15. package/agnostic/numbers/index.d.ts +3 -3
  16. package/agnostic/numbers/index.js +3 -3
  17. package/agnostic/objects/index.d.ts +3 -3
  18. package/agnostic/objects/index.js +3 -3
  19. package/agnostic/optim/index.d.ts +1 -1
  20. package/agnostic/optim/index.js +1 -1
  21. package/agnostic/strings/index.d.ts +4 -4
  22. package/agnostic/strings/index.js +4 -4
  23. package/agnostic/time/dates/format-date/index.d.ts +19 -4
  24. package/agnostic/time/dates/format-date/index.js +24 -7
  25. package/agnostic/time/dates/format-date/index.test.js +20 -7
  26. package/agnostic/time/dates/format-date/parts.js +4 -4
  27. package/agnostic/time/dates/format-date/types.d.ts +9 -9
  28. package/agnostic/time/duration/format-duration/index.d.ts +18 -1
  29. package/agnostic/time/duration/format-duration/index.js +44 -7
  30. package/agnostic/time/duration/format-duration/index.test.js +27 -0
  31. package/agnostic/time/duration/format-duration/types.d.ts +21 -1
  32. package/agnostic/time/index.d.ts +1 -1
  33. package/agnostic/time/index.js +1 -1
  34. package/components/Video/index.controlled.d.ts +12 -0
  35. package/components/Video/index.controlled.js +8 -3
  36. package/components/Video/utils.d.ts +0 -29
  37. package/components/Video/utils.js +0 -51
  38. package/components/index.d.ts +2 -2
  39. package/components/index.js +2 -2
  40. package/node/@aws-s3/storage/directory/index.d.ts +1 -1
  41. package/node/@aws-s3/storage/directory/index.js +1 -1
  42. package/node/@aws-s3/storage/file/index.d.ts +1 -1
  43. package/node/@aws-s3/storage/file/index.js +1 -1
  44. package/node/@aws-s3/storage/index.d.ts +1 -1
  45. package/node/@aws-s3/storage/index.js +1 -1
  46. package/node/@google-cloud/storage/directory/index.d.ts +1 -1
  47. package/node/@google-cloud/storage/directory/index.js +1 -1
  48. package/node/@google-cloud/storage/file/index.d.ts +2 -2
  49. package/node/@google-cloud/storage/file/index.js +2 -2
  50. package/node/cloud-storage/operations/index.d.ts +3 -3
  51. package/node/cloud-storage/operations/index.js +3 -3
  52. package/node/files/index.d.ts +1 -1
  53. package/node/files/index.js +1 -1
  54. package/node/ftps/directory/index.d.ts +1 -1
  55. package/node/ftps/directory/index.js +1 -1
  56. package/node/ftps/file/index.d.ts +2 -2
  57. package/node/ftps/file/index.js +2 -2
  58. package/node/images/transform/operations/index.d.ts +4 -4
  59. package/node/images/transform/operations/index.js +4 -4
  60. package/node/sftp/directory/index.d.ts +1 -1
  61. package/node/sftp/directory/index.js +1 -1
  62. package/package.json +1 -1
@@ -7,6 +7,6 @@ export * as invert from './invert/index.js'
7
7
  export * as lerp from './lerp/index.js'
8
8
  export * as luminance from './luminance/index.js'
9
9
  export * as palette from './palette/index.js'
10
- export * as rotate from './rotate/index.js'
11
10
  export * as tidy from './tidy/index.js'
11
+ export * as rotate from './rotate/index.js'
12
12
  export * as typechecks from './typechecks/index.js'
@@ -7,6 +7,6 @@ export * as invert from './invert/index.js'
7
7
  export * as lerp from './lerp/index.js'
8
8
  export * as luminance from './luminance/index.js'
9
9
  export * as palette from './palette/index.js'
10
- export * as rotate from './rotate/index.js'
11
10
  export * as tidy from './tidy/index.js'
11
+ export * as rotate from './rotate/index.js'
12
12
  export * as typechecks from './typechecks/index.js'
@@ -1,6 +1,6 @@
1
- export * as bem from './bem/index.js'
2
1
  export * as clss from './clss/index.js'
3
- export * as generateNiceColor from './generate-nice-color/index.js'
2
+ export * as bem from './bem/index.js'
4
3
  export * as isValidCssClassName from './is-valid-css-class-name/index.js'
4
+ export * as generateNiceColor from './generate-nice-color/index.js'
5
5
  export * as scale from './scale/index.js'
6
6
  export * as stylesSet from './styles-set/index.js'
@@ -1,6 +1,6 @@
1
- export * as bem from './bem/index.js'
2
1
  export * as clss from './clss/index.js'
3
- export * as generateNiceColor from './generate-nice-color/index.js'
2
+ export * as bem from './bem/index.js'
4
3
  export * as isValidCssClassName from './is-valid-css-class-name/index.js'
4
+ export * as generateNiceColor from './generate-nice-color/index.js'
5
5
  export * as scale from './scale/index.js'
6
6
  export * as stylesSet from './styles-set/index.js'
@@ -1,23 +1,24 @@
1
- export * as addclass from './addclass/index.js'
2
1
  export * as add from './add/index.js'
2
+ export * as addclass from './addclass/index.js'
3
3
  export * as and from './and/index.js'
4
+ export * as call from './call/index.js'
4
5
  export * as append from './append/index.js'
5
6
  export * as at from './at/index.js'
6
7
  export * as clone from './clone/index.js'
7
8
  export * as deleteproperties from './deleteproperties/index.js'
8
- export * as call from './call/index.js'
9
9
  export * as equals from './equals/index.js'
10
10
  export * as getattribute from './getattribute/index.js'
11
- export * as getproperty from './getproperty/index.js'
11
+ export * as getproperties from './getproperties/index.js'
12
12
  export * as hjparse from './hjparse/index.js'
13
13
  export * as hjstringify from './hjstringify/index.js'
14
+ export * as getproperty from './getproperty/index.js'
14
15
  export * as if from './if/index.js'
16
+ export * as initialize from './initialize/index.js'
15
17
  export * as join from './join/index.js'
16
- export * as getproperties from './getproperties/index.js'
17
- export * as length from './length/index.js'
18
18
  export * as map from './map/index.js'
19
- export * as initialize from './initialize/index.js'
19
+ export * as length from './length/index.js'
20
20
  export * as negate from './negate/index.js'
21
+ export * as notrailing from './notrailing/index.js'
21
22
  export * as or from './or/index.js'
22
23
  export * as pickrandom from './pickrandom/index.js'
23
24
  export * as populate from './populate/index.js'
@@ -25,28 +26,27 @@ export * as print from './print/index.js'
25
26
  export * as push from './push/index.js'
26
27
  export * as pusheach from './pusheach/index.js'
27
28
  export * as recordtoarray from './recordtoarray/index.js'
28
- export * as notrailing from './notrailing/index.js'
29
29
  export * as removeattribute from './removeattribute/index.js'
30
- export * as removeclass from './removeclass/index.js'
31
30
  export * as renameproperty from './renameproperty/index.js'
32
31
  export * as replace from './replace/index.js'
32
+ export * as removeclass from './removeclass/index.js'
33
33
  export * as select from './select/index.js'
34
34
  export * as set from './set/index.js'
35
- export * as setproperty from './setproperty/index.js'
36
35
  export * as setattribute from './setattribute/index.js'
37
- export * as split from './split/index.js'
38
36
  export * as sorton from './sorton/index.js'
39
- export * as toarray from './toarray/index.js'
37
+ export * as setproperty from './setproperty/index.js'
38
+ export * as split from './split/index.js'
40
39
  export * as spread from './spread/index.js'
40
+ export * as toarray from './toarray/index.js'
41
41
  export * as toboolean from './toboolean/index.js'
42
42
  export * as toelement from './toelement/index.js'
43
43
  export * as toggleclass from './toggleclass/index.js'
44
44
  export * as tonodelist from './tonodelist/index.js'
45
45
  export * as tonull from './tonull/index.js'
46
46
  export * as tonumber from './tonumber/index.js'
47
- export * as toref from './toref/index.js'
48
47
  export * as torecord from './torecord/index.js'
49
- export * as tostring from './tostring/index.js'
48
+ export * as toref from './toref/index.js'
50
49
  export * as totext from './totext/index.js'
51
- export * as transformselected from './transformselected/index.js'
50
+ export * as tostring from './tostring/index.js'
52
51
  export * as trim from './trim/index.js'
52
+ export * as transformselected from './transformselected/index.js'
@@ -1,23 +1,24 @@
1
- export * as addclass from './addclass/index.js'
2
1
  export * as add from './add/index.js'
2
+ export * as addclass from './addclass/index.js'
3
3
  export * as and from './and/index.js'
4
+ export * as call from './call/index.js'
4
5
  export * as append from './append/index.js'
5
6
  export * as at from './at/index.js'
6
7
  export * as clone from './clone/index.js'
7
8
  export * as deleteproperties from './deleteproperties/index.js'
8
- export * as call from './call/index.js'
9
9
  export * as equals from './equals/index.js'
10
10
  export * as getattribute from './getattribute/index.js'
11
- export * as getproperty from './getproperty/index.js'
11
+ export * as getproperties from './getproperties/index.js'
12
12
  export * as hjparse from './hjparse/index.js'
13
13
  export * as hjstringify from './hjstringify/index.js'
14
+ export * as getproperty from './getproperty/index.js'
14
15
  export * as if from './if/index.js'
16
+ export * as initialize from './initialize/index.js'
15
17
  export * as join from './join/index.js'
16
- export * as getproperties from './getproperties/index.js'
17
- export * as length from './length/index.js'
18
18
  export * as map from './map/index.js'
19
- export * as initialize from './initialize/index.js'
19
+ export * as length from './length/index.js'
20
20
  export * as negate from './negate/index.js'
21
+ export * as notrailing from './notrailing/index.js'
21
22
  export * as or from './or/index.js'
22
23
  export * as pickrandom from './pickrandom/index.js'
23
24
  export * as populate from './populate/index.js'
@@ -25,28 +26,27 @@ export * as print from './print/index.js'
25
26
  export * as push from './push/index.js'
26
27
  export * as pusheach from './pusheach/index.js'
27
28
  export * as recordtoarray from './recordtoarray/index.js'
28
- export * as notrailing from './notrailing/index.js'
29
29
  export * as removeattribute from './removeattribute/index.js'
30
- export * as removeclass from './removeclass/index.js'
31
30
  export * as renameproperty from './renameproperty/index.js'
32
31
  export * as replace from './replace/index.js'
32
+ export * as removeclass from './removeclass/index.js'
33
33
  export * as select from './select/index.js'
34
34
  export * as set from './set/index.js'
35
- export * as setproperty from './setproperty/index.js'
36
35
  export * as setattribute from './setattribute/index.js'
37
- export * as split from './split/index.js'
38
36
  export * as sorton from './sorton/index.js'
39
- export * as toarray from './toarray/index.js'
37
+ export * as setproperty from './setproperty/index.js'
38
+ export * as split from './split/index.js'
40
39
  export * as spread from './spread/index.js'
40
+ export * as toarray from './toarray/index.js'
41
41
  export * as toboolean from './toboolean/index.js'
42
42
  export * as toelement from './toelement/index.js'
43
43
  export * as toggleclass from './toggleclass/index.js'
44
44
  export * as tonodelist from './tonodelist/index.js'
45
45
  export * as tonull from './tonull/index.js'
46
46
  export * as tonumber from './tonumber/index.js'
47
- export * as toref from './toref/index.js'
48
47
  export * as torecord from './torecord/index.js'
49
- export * as tostring from './tostring/index.js'
48
+ export * as toref from './toref/index.js'
50
49
  export * as totext from './totext/index.js'
51
- export * as transformselected from './transformselected/index.js'
50
+ export * as tostring from './tostring/index.js'
52
51
  export * as trim from './trim/index.js'
52
+ export * as transformselected from './transformselected/index.js'
@@ -1,10 +1,10 @@
1
- export * as any from './any/index.js'
2
1
  export * as array from './array/index.js'
3
- export * as element from './element/index.js'
4
2
  export * as boolean from './boolean/index.js'
3
+ export * as any from './any/index.js'
4
+ export * as element from './element/index.js'
5
5
  export * as get from './get/index.js'
6
- export * as guess from './guess/index.js'
7
6
  export * as nodelist from './nodelist/index.js'
7
+ export * as guess from './guess/index.js'
8
8
  export * as null from './null/index.js'
9
9
  export * as number from './number/index.js'
10
10
  export * as record from './record/index.js'
@@ -1,10 +1,10 @@
1
- export * as any from './any/index.js'
2
1
  export * as array from './array/index.js'
3
- export * as element from './element/index.js'
4
2
  export * as boolean from './boolean/index.js'
3
+ export * as any from './any/index.js'
4
+ export * as element from './element/index.js'
5
5
  export * as get from './get/index.js'
6
- export * as guess from './guess/index.js'
7
6
  export * as nodelist from './nodelist/index.js'
7
+ export * as guess from './guess/index.js'
8
8
  export * as null from './null/index.js'
9
9
  export * as number from './number/index.js'
10
10
  export * as record from './record/index.js'
@@ -4,7 +4,7 @@ export * as getPositionInsideParent from './get-position-inside-parent/index.js'
4
4
  export * as hyperJson from './hyper-json/index.js'
5
5
  export * as insertNode from './insert-node/index.js'
6
6
  export * as placeholders from './placeholders/index.js'
7
- export * as selectorToElement from './selector-to-element/index.js'
8
7
  export * as replaceInElement from './replace-in-element/index.js'
9
- export * as stringToNodes from './string-to-nodes/index.js'
10
8
  export * as watchSelection from './watch-selection/index.js'
9
+ export * as stringToNodes from './string-to-nodes/index.js'
10
+ export * as selectorToElement from './selector-to-element/index.js'
@@ -4,7 +4,7 @@ export * as getPositionInsideParent from './get-position-inside-parent/index.js'
4
4
  export * as hyperJson from './hyper-json/index.js'
5
5
  export * as insertNode from './insert-node/index.js'
6
6
  export * as placeholders from './placeholders/index.js'
7
- export * as selectorToElement from './selector-to-element/index.js'
8
7
  export * as replaceInElement from './replace-in-element/index.js'
9
- export * as stringToNodes from './string-to-nodes/index.js'
10
8
  export * as watchSelection from './watch-selection/index.js'
9
+ export * as stringToNodes from './string-to-nodes/index.js'
10
+ export * as selectorToElement from './selector-to-element/index.js'
@@ -1,9 +1,8 @@
1
- export * as booleans from './booleans/index.js'
2
1
  export * as arrays from './arrays/index.js'
2
+ export * as booleans from './booleans/index.js'
3
3
  export * as colors from './colors/index.js'
4
4
  export * as css from './css/index.js'
5
5
  export * as errors from './errors/index.js'
6
- export * as html from './html/index.js'
7
6
  export * as misc from './misc/index.js'
8
7
  export * as numbers from './numbers/index.js'
9
8
  export * as objects from './objects/index.js'
@@ -11,6 +10,7 @@ export * as optim from './optim/index.js'
11
10
  export * as random from './random/index.js'
12
11
  export * as regexps from './regexps/index.js'
13
12
  export * as sanitization from './sanitization/index.js'
13
+ export * as html from './html/index.js'
14
14
  export * as strings from './strings/index.js'
15
15
  export * as subtitles from './subtitles/index.js'
16
16
  export * as time from './time/index.js'
package/agnostic/index.js CHANGED
@@ -1,9 +1,8 @@
1
- export * as booleans from './booleans/index.js'
2
1
  export * as arrays from './arrays/index.js'
2
+ export * as booleans from './booleans/index.js'
3
3
  export * as colors from './colors/index.js'
4
4
  export * as css from './css/index.js'
5
5
  export * as errors from './errors/index.js'
6
- export * as html from './html/index.js'
7
6
  export * as misc from './misc/index.js'
8
7
  export * as numbers from './numbers/index.js'
9
8
  export * as objects from './objects/index.js'
@@ -11,6 +10,7 @@ export * as optim from './optim/index.js'
11
10
  export * as random from './random/index.js'
12
11
  export * as regexps from './regexps/index.js'
13
12
  export * as sanitization from './sanitization/index.js'
13
+ export * as html from './html/index.js'
14
14
  export * as strings from './strings/index.js'
15
15
  export * as subtitles from './subtitles/index.js'
16
16
  export * as time from './time/index.js'
@@ -1,12 +1,12 @@
1
1
  export * as assert from './assert/index.js'
2
2
  export * as cast from './cast/index.js'
3
- export * as connection from './connection/index.js'
4
3
  export * as crawler from './crawler/index.js'
5
4
  export * as crossenv from './crossenv/index.js'
5
+ export * as connection from './connection/index.js'
6
6
  export * as dataSize from './data-size/index.js'
7
- export * as isConstructorFunction from './is-constructor-function/index.js'
8
7
  export * as isNullish from './is-nullish/index.js'
9
8
  export * as logs from './logs/index.js'
10
- export * as loremIpsum from './lorem-ipsum/index.js'
9
+ export * as isConstructorFunction from './is-constructor-function/index.js'
11
10
  export * as normalizeExtension from './normalize-extension/index.js'
11
+ export * as loremIpsum from './lorem-ipsum/index.js'
12
12
  export * as outcome from './outcome/index.js'
@@ -1,12 +1,12 @@
1
1
  export * as assert from './assert/index.js'
2
2
  export * as cast from './cast/index.js'
3
- export * as connection from './connection/index.js'
4
3
  export * as crawler from './crawler/index.js'
5
4
  export * as crossenv from './crossenv/index.js'
5
+ export * as connection from './connection/index.js'
6
6
  export * as dataSize from './data-size/index.js'
7
- export * as isConstructorFunction from './is-constructor-function/index.js'
8
7
  export * as isNullish from './is-nullish/index.js'
9
8
  export * as logs from './logs/index.js'
10
- export * as loremIpsum from './lorem-ipsum/index.js'
9
+ export * as isConstructorFunction from './is-constructor-function/index.js'
11
10
  export * as normalizeExtension from './normalize-extension/index.js'
11
+ export * as loremIpsum from './lorem-ipsum/index.js'
12
12
  export * as outcome from './outcome/index.js'
@@ -1,6 +1,6 @@
1
- export * as absoluteModulo from './absolute-modulo/index.js'
2
- export * as approximateRational from './approximate-rational/index.js'
3
1
  export * as clamp from './clamp/index.js'
4
- export * as interpolate from './interpolate/index.js'
2
+ export * as approximateRational from './approximate-rational/index.js'
5
3
  export * as geometricProgressions from './geometric-progressions/index.js'
6
4
  export * as round from './round/index.js'
5
+ export * as interpolate from './interpolate/index.js'
6
+ export * as absoluteModulo from './absolute-modulo/index.js'
@@ -1,6 +1,6 @@
1
- export * as absoluteModulo from './absolute-modulo/index.js'
2
- export * as approximateRational from './approximate-rational/index.js'
3
1
  export * as clamp from './clamp/index.js'
4
- export * as interpolate from './interpolate/index.js'
2
+ export * as approximateRational from './approximate-rational/index.js'
5
3
  export * as geometricProgressions from './geometric-progressions/index.js'
6
4
  export * as round from './round/index.js'
5
+ export * as interpolate from './interpolate/index.js'
6
+ export * as absoluteModulo from './absolute-modulo/index.js'
@@ -1,9 +1,9 @@
1
1
  export * as deepGetProperty from './deep-get-property/index.js'
2
- export * as flattenGetters from './flatten-getters/index.js'
3
2
  export * as enums from './enums/index.js'
4
- export * as isRecord from './is-record/index.js'
3
+ export * as flattenGetters from './flatten-getters/index.js'
5
4
  export * as isObject from './is-object/index.js'
6
5
  export * as recordFormat from './record-format/index.js'
7
- export * as sortKeys from './sort-keys/index.js'
6
+ export * as isRecord from './is-record/index.js'
8
7
  export * as recordMap from './record-map/index.js'
8
+ export * as sortKeys from './sort-keys/index.js'
9
9
  export * as validation from './validation/index.js'
@@ -1,9 +1,9 @@
1
1
  export * as deepGetProperty from './deep-get-property/index.js'
2
- export * as flattenGetters from './flatten-getters/index.js'
3
2
  export * as enums from './enums/index.js'
4
- export * as isRecord from './is-record/index.js'
3
+ export * as flattenGetters from './flatten-getters/index.js'
5
4
  export * as isObject from './is-object/index.js'
6
5
  export * as recordFormat from './record-format/index.js'
7
- export * as sortKeys from './sort-keys/index.js'
6
+ export * as isRecord from './is-record/index.js'
8
7
  export * as recordMap from './record-map/index.js'
8
+ export * as sortKeys from './sort-keys/index.js'
9
9
  export * as validation from './validation/index.js'
@@ -1,2 +1,2 @@
1
- export * as memoize from './memoize/index.js'
2
1
  export * as throttleDebounce from './throttle-debounce/index.js'
2
+ export * as memoize from './memoize/index.js'
@@ -1,2 +1,2 @@
1
- export * as memoize from './memoize/index.js'
2
1
  export * as throttleDebounce from './throttle-debounce/index.js'
2
+ export * as memoize from './memoize/index.js'
@@ -1,8 +1,8 @@
1
- export * as charCodes from './char-codes/index.js'
2
1
  export * as matches from './matches/index.js'
3
- export * as normalizeIndent from './normalize-indent/index.js'
2
+ export * as charCodes from './char-codes/index.js'
4
3
  export * as parseTable from './parse-table/index.js'
5
- export * as splitTrim from './split-trim/index.js'
4
+ export * as normalizeIndent from './normalize-indent/index.js'
5
+ export * as replaceAll from './replace-all/index.js'
6
6
  export * as toAlphanum from './to-alphanum/index.js'
7
7
  export * as trim from './trim/index.js'
8
- export * as replaceAll from './replace-all/index.js'
8
+ export * as splitTrim from './split-trim/index.js'
@@ -1,8 +1,8 @@
1
- export * as charCodes from './char-codes/index.js'
2
1
  export * as matches from './matches/index.js'
3
- export * as normalizeIndent from './normalize-indent/index.js'
2
+ export * as charCodes from './char-codes/index.js'
4
3
  export * as parseTable from './parse-table/index.js'
5
- export * as splitTrim from './split-trim/index.js'
4
+ export * as normalizeIndent from './normalize-indent/index.js'
5
+ export * as replaceAll from './replace-all/index.js'
6
6
  export * as toAlphanum from './to-alphanum/index.js'
7
7
  export * as trim from './trim/index.js'
8
- export * as replaceAll from './replace-all/index.js'
8
+ export * as splitTrim from './split-trim/index.js'
@@ -4,10 +4,10 @@
4
4
  * Supported tokens (placeholders must be wrapped in `{{...}}`):
5
5
  *
6
6
  * **Day**
7
- * - `D` : Day of month (1–31)
8
- * - `DD` : Day of month, padded (01–31)
9
- * - `d` : Short weekday name (Mon, Tue, ...)
10
- * - `dd` : Full weekday name (Monday, Tuesday, ...)
7
+ * - `D` / `d` : Day of month (1–31)
8
+ * - `DD` / `dd` : Day of month, padded (01–31)
9
+ * - `ddd` : Short weekday name (Mon, Tue, ...)
10
+ * - `dddd` : Full weekday name (Monday, Tuesday, ...)
11
11
  *
12
12
  * **Month**
13
13
  * - `M` : Month number (1–12)
@@ -45,6 +45,21 @@
45
45
  * @returns Formatted date string. An unknown token is left untouched, braces
46
46
  * included.
47
47
  * @see {@link getDateParts} to reach the same parts as plain values, unpadded.
48
+ * @see {@link formatDuration} — the same template grammar, for a length of time
49
+ * rather than a point in it.
50
+ *
51
+ * @remarks
52
+ * This function and `formatDuration` share one grammar, so a reader who has learnt
53
+ * either knows the other: tokens are delimited by `{{…}}` and everything outside
54
+ * them is literal; the bare token is the plain number and the doubled one is that
55
+ * same number padded to two digits; `ms` is padded to three; and an unknown token
56
+ * is left as written rather than blanked, so a typo shows.
57
+ *
58
+ * No token means two different kinds of thing across the two. What differs is only
59
+ * what each domain has to offer: a date has a meridiem, an ordinal suffix and a
60
+ * 12-hour clock (`h`/`hh`, against `H`/`HH` for the 24-hour one), while a duration
61
+ * has weeks and frames. The weekday names are `ddd`/`dddd`, mirroring `MMM`/`MMMM`
62
+ * — `d`/`dd` are the day number, as they are in a duration.
48
63
  *
49
64
  * @example
50
65
  * formatDate(new Date(2026, 0, 1, 15, 5), '{{YYYY}}-{{MM}}-{{DD}} {{hh}}:{{mm}} {{A}}')
@@ -2,7 +2,7 @@ import { getDateParts } from './parts.js';
2
2
  // Alternation is ordered, and the first branch that fits wins — so the longest
3
3
  // tokens come first. `MM` ahead of `MMMM` would only work by backtracking off the
4
4
  // closing braces, which is true but not something a reader should have to derive.
5
- const tokenRegexp = /\{\{(MMMM|YYYY|MMM|DD|dd|MM|YY|HH|hh|mm|ss|th|ms|D|d|M|H|h|m|s|A|a)\}\}/gv;
5
+ const tokenRegexp = /\{\{(MMMM|YYYY|dddd|MMM|ddd|DD|dd|MM|YY|HH|hh|mm|ss|th|ms|D|d|M|H|h|m|s|A|a)\}\}/gv;
6
6
  function pad(value, length) {
7
7
  return `${value}`.padStart(length, '0');
8
8
  }
@@ -14,8 +14,10 @@ function pad(value, length) {
14
14
  const renderers = {
15
15
  'D': parts => `${parts.D}`,
16
16
  'DD': parts => pad(parts.D, 2),
17
- 'd': parts => parts.d,
18
- 'dd': parts => parts.dd,
17
+ 'd': parts => `${parts.D}`,
18
+ 'dd': parts => pad(parts.D, 2),
19
+ 'ddd': parts => parts.ddd,
20
+ 'dddd': parts => parts.dddd,
19
21
  'M': parts => `${parts.M}`,
20
22
  'MM': parts => pad(parts.M, 2),
21
23
  'MMM': parts => parts.MMM,
@@ -41,10 +43,10 @@ const renderers = {
41
43
  * Supported tokens (placeholders must be wrapped in `{{...}}`):
42
44
  *
43
45
  * **Day**
44
- * - `D` : Day of month (1–31)
45
- * - `DD` : Day of month, padded (01–31)
46
- * - `d` : Short weekday name (Mon, Tue, ...)
47
- * - `dd` : Full weekday name (Monday, Tuesday, ...)
46
+ * - `D` / `d` : Day of month (1–31)
47
+ * - `DD` / `dd` : Day of month, padded (01–31)
48
+ * - `ddd` : Short weekday name (Mon, Tue, ...)
49
+ * - `dddd` : Full weekday name (Monday, Tuesday, ...)
48
50
  *
49
51
  * **Month**
50
52
  * - `M` : Month number (1–12)
@@ -82,6 +84,21 @@ const renderers = {
82
84
  * @returns Formatted date string. An unknown token is left untouched, braces
83
85
  * included.
84
86
  * @see {@link getDateParts} to reach the same parts as plain values, unpadded.
87
+ * @see {@link formatDuration} — the same template grammar, for a length of time
88
+ * rather than a point in it.
89
+ *
90
+ * @remarks
91
+ * This function and `formatDuration` share one grammar, so a reader who has learnt
92
+ * either knows the other: tokens are delimited by `{{…}}` and everything outside
93
+ * them is literal; the bare token is the plain number and the doubled one is that
94
+ * same number padded to two digits; `ms` is padded to three; and an unknown token
95
+ * is left as written rather than blanked, so a typo shows.
96
+ *
97
+ * No token means two different kinds of thing across the two. What differs is only
98
+ * what each domain has to offer: a date has a meridiem, an ordinal suffix and a
99
+ * 12-hour clock (`h`/`hh`, against `H`/`HH` for the 24-hour one), while a duration
100
+ * has weeks and frames. The weekday names are `ddd`/`dddd`, mirroring `MMM`/`MMMM`
101
+ * — `d`/`dd` are the day number, as they are in a duration.
85
102
  *
86
103
  * @example
87
104
  * formatDate(new Date(2026, 0, 1, 15, 5), '{{YYYY}}-{{MM}}-{{DD}} {{hh}}:{{mm}} {{A}}')
@@ -53,11 +53,24 @@ describe('formatDate', () => {
53
53
  });
54
54
  describe('locales', () => {
55
55
  it('names the weekday and the month in English by default', () => {
56
- expect(formatDate(thursdayAfternoon, '{{dd}} {{d}} {{MMMM}} {{MMM}}'))
56
+ expect(formatDate(thursdayAfternoon, '{{dddd}} {{ddd}} {{MMMM}} {{MMM}}'))
57
57
  .toBe('Thursday Thu January Jan');
58
58
  });
59
59
  it('names them in the requested locale', () => {
60
- expect(formatDate(thursdayAfternoon, '{{dd}} {{MMMM}}', 'fr')).toBe('jeudi janvier');
60
+ expect(formatDate(thursdayAfternoon, '{{dddd}} {{MMMM}}', 'fr')).toBe('jeudi janvier');
61
+ });
62
+ });
63
+ describe('day of month', () => {
64
+ it('reads the day number under d as well as under D', () => {
65
+ expect(formatDate(thursdayAfternoon, '{{d}} {{D}}')).toBe('1 1');
66
+ expect(formatDate(thursdayAfternoon, '{{dd}} {{DD}}')).toBe('01 01');
67
+ });
68
+ // The whole point of moving the weekday names to `ddd`/`dddd`: `{{d}}` and
69
+ // `{{dd}}` now read as a number here and in `formatDuration` alike, and the
70
+ // doubled form is the padded twin of the bare one everywhere.
71
+ it('does not let the shorter spellings swallow the weekday names', () => {
72
+ expect(formatDate(thursdayAfternoon, '{{ddd}}')).toBe('Thu');
73
+ expect(formatDate(thursdayAfternoon, '{{dddd}}')).toBe('Thursday');
61
74
  });
62
75
  });
63
76
  describe('ordinal suffix', () => {
@@ -104,8 +117,8 @@ describe('getDateParts', () => {
104
117
  const parts = getDateParts(thursdayAfternoon);
105
118
  expect(parts).toMatchObject({
106
119
  dayOfMonth: parts.D,
107
- shortWeekdayName: parts.d,
108
- fullWeekdayName: parts.dd,
120
+ shortWeekdayName: parts.ddd,
121
+ fullWeekdayName: parts.dddd,
109
122
  monthNumber: parts.M,
110
123
  shortMonthName: parts.MMM,
111
124
  fullMonthName: parts.MMMM,
@@ -134,15 +147,15 @@ describe('getDateParts', () => {
134
147
  describe('locales', () => {
135
148
  it('localises the weekday and month names', () => {
136
149
  expect(getDateParts(thursdayAfternoon, 'fr')).toMatchObject({
137
- d: 'jeu.',
138
- dd: 'jeudi',
150
+ ddd: 'jeu.',
151
+ dddd: 'jeudi',
139
152
  MMM: 'janv.',
140
153
  MMMM: 'janvier'
141
154
  });
142
155
  });
143
156
  it('falls back to English on a locale the runtime does not support', () => {
144
157
  expect(getDateParts(thursdayAfternoon, 'xx')).toMatchObject({
145
- dd: 'Thursday',
158
+ dddd: 'Thursday',
146
159
  MMMM: 'January',
147
160
  th: 'st'
148
161
  });
@@ -68,9 +68,9 @@ export function getDateParts(date, locale = 'en') {
68
68
  const tokens = {
69
69
  'D': day,
70
70
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
- 'd': weekdayNames(safeLocale, 'short')[dayOfWeek],
71
+ 'ddd': weekdayNames(safeLocale, 'short')[dayOfWeek],
72
72
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
73
- 'dd': weekdayNames(safeLocale, 'long')[dayOfWeek],
73
+ 'dddd': weekdayNames(safeLocale, 'long')[dayOfWeek],
74
74
  'M': month + 1,
75
75
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
76
76
  'MMM': monthNames(safeLocale, 'short')[month],
@@ -89,8 +89,8 @@ export function getDateParts(date, locale = 'en') {
89
89
  return {
90
90
  ...tokens,
91
91
  dayOfMonth: tokens.D,
92
- shortWeekdayName: tokens.d,
93
- fullWeekdayName: tokens.dd,
92
+ shortWeekdayName: tokens.ddd,
93
+ fullWeekdayName: tokens.dddd,
94
94
  monthNumber: tokens.M,
95
95
  shortMonthName: tokens.MMM,
96
96
  fullMonthName: tokens.MMMM,
@@ -1,21 +1,21 @@
1
1
  /** Every token `formatDate` substitutes in a template. */
2
- export type DateToken = 'D' | 'DD' | 'd' | 'dd' | 'M' | 'MM' | 'MMM' | 'MMMM' | 'YY' | 'YYYY' | 'H' | 'HH' | 'h' | 'hh' | 'm' | 'mm' | 's' | 'ss' | 'ms' | 'A' | 'a' | 'th';
2
+ export type DateToken = 'D' | 'DD' | 'd' | 'dd' | 'ddd' | 'dddd' | 'M' | 'MM' | 'MMM' | 'MMMM' | 'YY' | 'YYYY' | 'H' | 'HH' | 'h' | 'hh' | 'm' | 'mm' | 's' | 'ss' | 'ms' | 'A' | 'a' | 'th';
3
3
  /**
4
4
  * A date's parts, keyed by unit token.
5
5
  *
6
6
  * Quantities are **numbers** — a day of month is `1`, not `'01'`. Padding and
7
7
  * truncation are rendering concerns and belong to `formatDate`, which is why the
8
- * `DD`, `MM`, `YY`, `HH`, `hh`, `mm` and `ss` tokens have no entry here: they
9
- * render the same quantity as their unpadded twin. The parts that are localised
10
- * text rather than a quantity stay strings.
8
+ * `d`, `dd`, `DD`, `MM`, `YY`, `HH`, `hh`, `mm` and `ss` tokens have no entry
9
+ * here: they render the same quantity as the bare token they double. The parts
10
+ * that are localised text rather than a quantity stay strings.
11
11
  */
12
12
  export type DateTokenParts = {
13
- /** Day of month, 1–31. */
13
+ /** Day of month, 1–31. Rendered by `D`, `DD`, `d` and `dd` alike. */
14
14
  D: number;
15
15
  /** Short weekday name, localised. */
16
- d: string;
16
+ ddd: string;
17
17
  /** Full weekday name, localised. */
18
- dd: string;
18
+ dddd: string;
19
19
  /** Month number, 1–12 — January is `1`, not `0`. */
20
20
  M: number;
21
21
  /** Short month name, localised. */
@@ -51,9 +51,9 @@ export type DateTokenParts = {
51
51
  export type NamedDateParts = {
52
52
  /** {@link DateTokenParts.D} */
53
53
  dayOfMonth: number;
54
- /** {@link DateTokenParts.d} */
54
+ /** {@link DateTokenParts.ddd} */
55
55
  shortWeekdayName: string;
56
- /** {@link DateTokenParts.dd} */
56
+ /** {@link DateTokenParts.dddd} */
57
57
  fullWeekdayName: string;
58
58
  /** {@link DateTokenParts.M} */
59
59
  monthNumber: number;