@thi.ng/date 2.8.0 → 2.8.1

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.
package/api.d.ts CHANGED
@@ -170,6 +170,10 @@ export type Period = Precision | "w" | "q";
170
170
  */
171
171
  export declare const PERIODS: Record<Period, number>;
172
172
  export type FormatFn = Fn2<Date, boolean, string>;
173
+ /**
174
+ * A function returned by {@link defFormat}.
175
+ */
176
+ export type Formatter = (x?: MaybeDate, utc?: boolean) => string;
173
177
  export type MaybeDate = DateTime | Date | number | string;
174
178
  /**
175
179
  * Date rounding function for {@link MaybeDate} inputs.
package/format.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type FormatFn, type MaybeDate, type Precision } from "./api.js";
1
+ import { type FormatFn, type Formatter, type MaybeDate, type Precision } from "./api.js";
2
2
  export declare const FORMATTERS: Record<string, FormatFn>;
3
3
  /**
4
4
  * Returns a new date formatter for given array of format strings (or
@@ -32,94 +32,94 @@ export declare const FORMATTERS: Record<string, FormatFn>;
32
32
  *
33
33
  * @param fmt -
34
34
  */
35
- export declare const defFormat: (fmt: (string | FormatFn)[]) => (x?: MaybeDate, utc?: boolean) => string;
35
+ export declare const defFormat: (fmt: (string | FormatFn)[]) => Formatter;
36
36
  /**
37
37
  * Format preset, e.g. `2020-09-19`
38
38
  */
39
- export declare const FMT_yyyyMMdd: (x?: MaybeDate, utc?: boolean) => string;
39
+ export declare const FMT_yyyyMMdd: Formatter;
40
40
  /**
41
41
  * Format preset, e.g. `20200919`
42
42
  */
43
- export declare const FMT_yyyyMMdd_ALT: (x?: MaybeDate, utc?: boolean) => string;
43
+ export declare const FMT_yyyyMMdd_ALT: Formatter;
44
44
  /**
45
45
  * Format preset, e.g. `9/19/2020`
46
46
  */
47
- export declare const FMT_Mdyyyy: (x?: MaybeDate, utc?: boolean) => string;
47
+ export declare const FMT_Mdyyyy: Formatter;
48
48
  /**
49
49
  * Format preset, e.g. `Sep 19 2020`. Uses current `LOCALE`, see
50
50
  * {@link setLocale}.
51
51
  */
52
- export declare const FMT_MMMdyyyy: (x?: MaybeDate, utc?: boolean) => string;
52
+ export declare const FMT_MMMdyyyy: Formatter;
53
53
  /**
54
54
  * Format preset, e.g. `19.9.2020`
55
55
  */
56
- export declare const FMT_dMyyyy: (x?: MaybeDate, utc?: boolean) => string;
56
+ export declare const FMT_dMyyyy: Formatter;
57
57
  /**
58
58
  * Format preset, e.g. `19 Sep 2020`
59
59
  */
60
- export declare const FMT_dMMMyyyy: (x?: MaybeDate, utc?: boolean) => string;
60
+ export declare const FMT_dMMMyyyy: Formatter;
61
61
  /**
62
62
  * Format preset, e.g. `17:08`
63
63
  */
64
- export declare const FMT_HHmm: (x?: MaybeDate, utc?: boolean) => string;
64
+ export declare const FMT_HHmm: Formatter;
65
65
  /**
66
66
  * Format preset, e.g. `5:08 PM`
67
67
  */
68
- export declare const FMT_hm: (x?: MaybeDate, utc?: boolean) => string;
68
+ export declare const FMT_hm: Formatter;
69
69
  /**
70
70
  * Format preset, e.g. `17:08:01`
71
71
  */
72
- export declare const FMT_HHmmss: (x?: MaybeDate, utc?: boolean) => string;
72
+ export declare const FMT_HHmmss: Formatter;
73
73
  /**
74
74
  * Format preset, e.g. `170801`
75
75
  */
76
- export declare const FMT_HHmmss_ALT: (x?: MaybeDate, utc?: boolean) => string;
76
+ export declare const FMT_HHmmss_ALT: Formatter;
77
77
  /**
78
78
  * Format preset, e.g. `5:08:01 PM`
79
79
  */
80
- export declare const FMT_hms: (x?: MaybeDate, utc?: boolean) => string;
80
+ export declare const FMT_hms: Formatter;
81
81
  /**
82
82
  * Format preset, e.g. `20200919-170801`
83
83
  */
84
- export declare const FMT_yyyyMMdd_HHmmss: (x?: MaybeDate, utc?: boolean) => string;
84
+ export declare const FMT_yyyyMMdd_HHmmss: Formatter;
85
85
  /**
86
86
  * ISO8601 format preset (without millisecond term), e.g.
87
87
  * `2020-09-19T17:08:01Z`
88
88
  */
89
- export declare const FMT_ISO_SHORT: (x?: MaybeDate, utc?: boolean) => string;
89
+ export declare const FMT_ISO_SHORT: Formatter;
90
90
  /**
91
91
  * ISO8601 format preset (with millisecond term), e.g.
92
92
  * `2020-09-19T17:08:01.123Z`
93
93
  */
94
- export declare const FMT_ISO: (x?: MaybeDate, utc?: boolean) => string;
94
+ export declare const FMT_ISO: Formatter;
95
95
  /**
96
96
  * Format preset, 4-digit year only
97
97
  */
98
- export declare const FMT_yyyy: (x?: MaybeDate, utc?: boolean) => string;
98
+ export declare const FMT_yyyy: Formatter;
99
99
  /**
100
100
  * Format preset, 2-digit month only
101
101
  */
102
- export declare const FMT_MM: (x?: MaybeDate, utc?: boolean) => string;
102
+ export declare const FMT_MM: Formatter;
103
103
  /**
104
104
  * Format preset, 2-digit week in year only
105
105
  */
106
- export declare const FMT_ww: (x?: MaybeDate, utc?: boolean) => string;
106
+ export declare const FMT_ww: Formatter;
107
107
  /**
108
108
  * Format preset, 2-digit day in month only
109
109
  */
110
- export declare const FMT_dd: (x?: MaybeDate, utc?: boolean) => string;
110
+ export declare const FMT_dd: Formatter;
111
111
  /**
112
112
  * Format preset, 2-digit hour only
113
113
  */
114
- export declare const FMT_HH: (x?: MaybeDate, utc?: boolean) => string;
114
+ export declare const FMT_HH: Formatter;
115
115
  /**
116
116
  * Format preset, 2-digit minute only
117
117
  */
118
- export declare const FMT_mm: (x?: MaybeDate, utc?: boolean) => string;
118
+ export declare const FMT_mm: Formatter;
119
119
  /**
120
120
  * Format preset, 2-digit second only
121
121
  */
122
- export declare const FMT_ss: (x?: MaybeDate, utc?: boolean) => string;
122
+ export declare const FMT_ss: Formatter;
123
123
  /**
124
124
  * Takes a `date` and optional reference `base` date and (also optional
125
125
  * `prec`ision, i.e. number of fractional digits, default: 0). Computes the
package/i18n/en.js CHANGED
@@ -56,7 +56,6 @@ const EN_LONG = {
56
56
  ],
57
57
  sepDM: " ",
58
58
  sepMY: " ",
59
- sepHM: ".",
60
59
  time: ["h", "/HM", "mm", " ", "a"],
61
60
  units: {
62
61
  y: { s: "year", p: "years" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/date",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Datetime types, relative dates, math, iterators, composable formatters, locales",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -135,5 +135,5 @@
135
135
  "thi.ng": {
136
136
  "year": 2020
137
137
  },
138
- "gitHead": "4924437d79b0a602593f972b6537d8eba3e0b2ee\n"
138
+ "gitHead": "4eaee6aed1a23312217b85bbb1285c754ba1b446\n"
139
139
  }