@hotmeshio/hotmesh 0.14.0 → 0.14.2
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/build/package.json +1 -1
- package/build/services/pipe/functions/array.d.ts +219 -0
- package/build/services/pipe/functions/array.js +219 -0
- package/build/services/pipe/functions/bitwise.d.ts +94 -0
- package/build/services/pipe/functions/bitwise.js +94 -0
- package/build/services/pipe/functions/conditional.d.ts +161 -0
- package/build/services/pipe/functions/conditional.js +161 -0
- package/build/services/pipe/functions/cron.d.ts +23 -4
- package/build/services/pipe/functions/cron.js +23 -4
- package/build/services/pipe/functions/date.d.ts +737 -6
- package/build/services/pipe/functions/date.js +742 -5
- package/build/services/pipe/functions/json.d.ts +42 -0
- package/build/services/pipe/functions/json.js +42 -0
- package/build/services/pipe/functions/logical.d.ts +38 -0
- package/build/services/pipe/functions/logical.js +38 -0
- package/build/services/pipe/functions/math.d.ts +533 -0
- package/build/services/pipe/functions/math.js +533 -0
- package/build/services/pipe/functions/number.d.ts +258 -0
- package/build/services/pipe/functions/number.js +258 -0
- package/build/services/pipe/functions/object.d.ts +321 -0
- package/build/services/pipe/functions/object.js +321 -0
- package/build/services/pipe/functions/string.d.ts +306 -0
- package/build/services/pipe/functions/string.js +306 -0
- package/build/services/pipe/functions/symbol.d.ts +112 -0
- package/build/services/pipe/functions/symbol.js +112 -0
- package/build/services/pipe/functions/unary.d.ts +65 -0
- package/build/services/pipe/functions/unary.js +65 -0
- package/build/services/router/error-handling/index.js +7 -1
- package/build/services/virtual/index.js +6 -0
- package/build/services/virtual/schemas/factory.js +1 -1
- package/build/types/virtual.d.ts +21 -0
- package/package.json +1 -1
|
@@ -1,58 +1,789 @@
|
|
|
1
|
-
type DateInput = Date | string | number;
|
|
1
|
+
export type DateInput = Date | string | number;
|
|
2
|
+
/**
|
|
3
|
+
* Provides date manipulation and formatting functions for use in HotMesh
|
|
4
|
+
* mapping rules. Although inspired by JavaScript's Date API, these methods
|
|
5
|
+
* follow a functional approach where each transformation expects one or more
|
|
6
|
+
* input parameters from the prior row in the `@pipe` structure.
|
|
7
|
+
*
|
|
8
|
+
* Many methods accept various input formats (`Date`, `string`, and `number`),
|
|
9
|
+
* implicitly casting to dates as necessary. The ISO 8601 Extended Format is
|
|
10
|
+
* supported, including date strings like `YYYY-MM-DD`,
|
|
11
|
+
* `YYYY-MM-DDTHH:mm:ss`, and `YYYY-MM-DDTHH:mm:ss.sssZ`. Strings or numbers
|
|
12
|
+
* representing milliseconds since the Unix epoch are also accepted.
|
|
13
|
+
*
|
|
14
|
+
* @remarks Methods are invoked as `{@date.<method>}`, e.g., `{@date.now}` or `{@date.getFullYear}`.
|
|
15
|
+
*/
|
|
2
16
|
declare class DateHandler {
|
|
3
17
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
18
|
+
* Converts a date input (ISO string, milliseconds, or Date instance) into a
|
|
19
|
+
* native Date object. This static helper centralises the parsing logic used
|
|
20
|
+
* by every other DateHandler method, allowing concise mapping rules that
|
|
21
|
+
* avoid date-initialisation boilerplate.
|
|
22
|
+
*
|
|
23
|
+
* @param {DateInput} input - A date value as an ISO 8601 string, numeric milliseconds since epoch, or an existing Date instance.
|
|
24
|
+
* @returns {Date} A native Date object corresponding to the input.
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const d = DateHandler.getDateInstance('2023-04-23T12:00:00.000Z');
|
|
28
|
+
* ```
|
|
9
29
|
*/
|
|
10
30
|
static getDateInstance(input: DateInput): Date;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new Date object from a string representation of a date in
|
|
33
|
+
* ISO 8601 format.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} isoString - An ISO 8601 date string (e.g., `"2023-04-23T12:00:00.000Z"`).
|
|
36
|
+
* @returns {Date} A Date object corresponding to the provided ISO string.
|
|
37
|
+
* @example
|
|
38
|
+
* ```yaml
|
|
39
|
+
* date_obj:
|
|
40
|
+
* "@pipe":
|
|
41
|
+
* - ["{a.output.data.isoDate}"]
|
|
42
|
+
* - ["{@date.fromISOString}"]
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
11
45
|
fromISOString(isoString: string): Date;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the current time in milliseconds since the Unix epoch
|
|
48
|
+
* (January 1, 1970 00:00:00 UTC). Takes no parameters.
|
|
49
|
+
*
|
|
50
|
+
* @returns {number} The current timestamp in milliseconds.
|
|
51
|
+
* @example
|
|
52
|
+
* ```yaml
|
|
53
|
+
* current_time:
|
|
54
|
+
* "@pipe":
|
|
55
|
+
* - ["{@date.now}"]
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
12
58
|
now(): number;
|
|
59
|
+
/**
|
|
60
|
+
* Returns today's date formatted as a `YYYY-MM-DD` string using UTC.
|
|
61
|
+
* Takes no parameters, similar to `date.now`.
|
|
62
|
+
*
|
|
63
|
+
* @returns {string} Today's date in `YYYY-MM-DD` format.
|
|
64
|
+
* @example
|
|
65
|
+
* ```yaml
|
|
66
|
+
* today:
|
|
67
|
+
* "@pipe":
|
|
68
|
+
* - ["{@date.yyyymmdd}"]
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
yyyymmdd(): string;
|
|
72
|
+
/**
|
|
73
|
+
* Parses a string representation of a date and returns the number of
|
|
74
|
+
* milliseconds since the Unix epoch (January 1, 1970 00:00:00 UTC).
|
|
75
|
+
*
|
|
76
|
+
* @param {string} dateString - A date string to parse (e.g., `"April 23, 2023 12:00:00"`).
|
|
77
|
+
* @returns {number} Milliseconds since the Unix epoch for the given date string.
|
|
78
|
+
* @example
|
|
79
|
+
* ```yaml
|
|
80
|
+
* date_milliseconds:
|
|
81
|
+
* "@pipe":
|
|
82
|
+
* - ["{a.output.data.dateString}"]
|
|
83
|
+
* - ["{@date.parse}"]
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
13
86
|
parse(dateString: string): number;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the day of the month (1--31) for the specified date according to
|
|
89
|
+
* local time.
|
|
90
|
+
*
|
|
91
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
92
|
+
* @returns {number} The day of the month (1--31).
|
|
93
|
+
* @example
|
|
94
|
+
* ```yaml
|
|
95
|
+
* day_of_month:
|
|
96
|
+
* "@pipe":
|
|
97
|
+
* - ["{a.output.data.date}"]
|
|
98
|
+
* - ["{@date.getDate}"]
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
14
101
|
getDate(date: DateInput): number;
|
|
102
|
+
/**
|
|
103
|
+
* Returns the day of the week (0--6, where 0 is Sunday) for the specified
|
|
104
|
+
* date according to local time.
|
|
105
|
+
*
|
|
106
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
107
|
+
* @returns {number} The day of the week (0 = Sunday, 6 = Saturday).
|
|
108
|
+
* @example
|
|
109
|
+
* ```yaml
|
|
110
|
+
* day_of_week:
|
|
111
|
+
* "@pipe":
|
|
112
|
+
* - ["{a.output.data.date}"]
|
|
113
|
+
* - ["{@date.getDay}"]
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
15
116
|
getDay(date: DateInput): number;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the full year (4 digits) for the specified date according to
|
|
119
|
+
* local time.
|
|
120
|
+
*
|
|
121
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
122
|
+
* @returns {number} The four-digit year.
|
|
123
|
+
* @example
|
|
124
|
+
* ```yaml
|
|
125
|
+
* full_year:
|
|
126
|
+
* "@pipe":
|
|
127
|
+
* - ["{a.output.data.date}"]
|
|
128
|
+
* - ["{@date.getFullYear}"]
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
16
131
|
getFullYear(date: DateInput): number;
|
|
132
|
+
/**
|
|
133
|
+
* Returns the hour (0--23) for the specified date according to local time.
|
|
134
|
+
*
|
|
135
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
136
|
+
* @returns {number} The hour (0--23).
|
|
137
|
+
* @example
|
|
138
|
+
* ```yaml
|
|
139
|
+
* hour:
|
|
140
|
+
* "@pipe":
|
|
141
|
+
* - ["{a.output.data.date}"]
|
|
142
|
+
* - ["{@date.getHours}"]
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
17
145
|
getHours(date: DateInput): number;
|
|
146
|
+
/**
|
|
147
|
+
* Returns the milliseconds (0--999) for the specified date according to
|
|
148
|
+
* local time.
|
|
149
|
+
*
|
|
150
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
151
|
+
* @returns {number} The milliseconds component (0--999).
|
|
152
|
+
* @example
|
|
153
|
+
* ```yaml
|
|
154
|
+
* milliseconds:
|
|
155
|
+
* "@pipe":
|
|
156
|
+
* - ["{a.output.data.date}"]
|
|
157
|
+
* - ["{@date.getMilliseconds}"]
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
18
160
|
getMilliseconds(date: DateInput): number;
|
|
161
|
+
/**
|
|
162
|
+
* Returns the minutes (0--59) for the specified date according to local
|
|
163
|
+
* time.
|
|
164
|
+
*
|
|
165
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
166
|
+
* @returns {number} The minutes component (0--59).
|
|
167
|
+
* @example
|
|
168
|
+
* ```yaml
|
|
169
|
+
* minutes:
|
|
170
|
+
* "@pipe":
|
|
171
|
+
* - ["{a.output.data.date}"]
|
|
172
|
+
* - ["{@date.getMinutes}"]
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
19
175
|
getMinutes(date: DateInput): number;
|
|
176
|
+
/**
|
|
177
|
+
* Returns the month (0--11, where 0 is January) for the specified date
|
|
178
|
+
* according to local time.
|
|
179
|
+
*
|
|
180
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
181
|
+
* @returns {number} The month (0 = January, 11 = December).
|
|
182
|
+
* @example
|
|
183
|
+
* ```yaml
|
|
184
|
+
* month:
|
|
185
|
+
* "@pipe":
|
|
186
|
+
* - ["{a.output.data.date}"]
|
|
187
|
+
* - ["{@date.getMonth}"]
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
20
190
|
getMonth(date: DateInput): number;
|
|
191
|
+
/**
|
|
192
|
+
* Returns the seconds (0--59) for the specified date according to local
|
|
193
|
+
* time.
|
|
194
|
+
*
|
|
195
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
196
|
+
* @returns {number} The seconds component (0--59).
|
|
197
|
+
* @example
|
|
198
|
+
* ```yaml
|
|
199
|
+
* seconds:
|
|
200
|
+
* "@pipe":
|
|
201
|
+
* - ["{a.output.data.date}"]
|
|
202
|
+
* - ["{@date.getSeconds}"]
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
21
205
|
getSeconds(date: DateInput): number;
|
|
206
|
+
/**
|
|
207
|
+
* Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC
|
|
208
|
+
* for the specified date.
|
|
209
|
+
*
|
|
210
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
211
|
+
* @returns {number} Milliseconds since the Unix epoch.
|
|
212
|
+
* @example
|
|
213
|
+
* ```yaml
|
|
214
|
+
* time:
|
|
215
|
+
* "@pipe":
|
|
216
|
+
* - ["{a.output.data.date}"]
|
|
217
|
+
* - ["{@date.getTime}"]
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
22
220
|
getTime(date: DateInput): number;
|
|
221
|
+
/**
|
|
222
|
+
* Returns the time zone difference, in minutes, from the current locale
|
|
223
|
+
* (host system settings) to UTC.
|
|
224
|
+
*
|
|
225
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
226
|
+
* @returns {number} The timezone offset in minutes.
|
|
227
|
+
* @example
|
|
228
|
+
* ```yaml
|
|
229
|
+
* timezone_offset:
|
|
230
|
+
* "@pipe":
|
|
231
|
+
* - ["{a.output.data.date}"]
|
|
232
|
+
* - ["{@date.getTimezoneOffset}"]
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
23
235
|
getTimezoneOffset(date: DateInput): number;
|
|
236
|
+
/**
|
|
237
|
+
* Returns the day of the month (1--31) for the specified date according to
|
|
238
|
+
* universal time (UTC).
|
|
239
|
+
*
|
|
240
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
241
|
+
* @returns {number} The UTC day of the month (1--31).
|
|
242
|
+
* @example
|
|
243
|
+
* ```yaml
|
|
244
|
+
* utc_day:
|
|
245
|
+
* "@pipe":
|
|
246
|
+
* - ["{a.output.data.date}"]
|
|
247
|
+
* - ["{@date.getUTCDate}"]
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
24
250
|
getUTCDate(date: DateInput): number;
|
|
251
|
+
/**
|
|
252
|
+
* Returns the day of the week (0--6, where 0 is Sunday) for the specified
|
|
253
|
+
* date according to universal time (UTC).
|
|
254
|
+
*
|
|
255
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
256
|
+
* @returns {number} The UTC day of the week (0 = Sunday, 6 = Saturday).
|
|
257
|
+
* @example
|
|
258
|
+
* ```yaml
|
|
259
|
+
* utc_weekday:
|
|
260
|
+
* "@pipe":
|
|
261
|
+
* - ["{a.output.data.date}"]
|
|
262
|
+
* - ["{@date.getUTCDay}"]
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
25
265
|
getUTCDay(date: DateInput): number;
|
|
266
|
+
/**
|
|
267
|
+
* Returns the year of the specified date according to universal time (UTC).
|
|
268
|
+
*
|
|
269
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
270
|
+
* @returns {number} The four-digit UTC year.
|
|
271
|
+
* @example
|
|
272
|
+
* ```yaml
|
|
273
|
+
* utc_year:
|
|
274
|
+
* "@pipe":
|
|
275
|
+
* - ["{a.output.data.date}"]
|
|
276
|
+
* - ["{@date.getUTCFullYear}"]
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
26
279
|
getUTCFullYear(date: DateInput): number;
|
|
280
|
+
/**
|
|
281
|
+
* Returns the hours (0--23) of the specified date according to universal
|
|
282
|
+
* time (UTC).
|
|
283
|
+
*
|
|
284
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
285
|
+
* @returns {number} The UTC hours (0--23).
|
|
286
|
+
* @example
|
|
287
|
+
* ```yaml
|
|
288
|
+
* utc_hours:
|
|
289
|
+
* "@pipe":
|
|
290
|
+
* - ["{a.output.data.date}"]
|
|
291
|
+
* - ["{@date.getUTCHours}"]
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
27
294
|
getUTCHours(date: DateInput): number;
|
|
295
|
+
/**
|
|
296
|
+
* Returns the milliseconds (0--999) of the specified date according to
|
|
297
|
+
* universal time (UTC).
|
|
298
|
+
*
|
|
299
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
300
|
+
* @returns {number} The UTC milliseconds (0--999).
|
|
301
|
+
* @example
|
|
302
|
+
* ```yaml
|
|
303
|
+
* utc_milliseconds:
|
|
304
|
+
* "@pipe":
|
|
305
|
+
* - ["{a.output.data.date}"]
|
|
306
|
+
* - ["{@date.getUTCMilliseconds}"]
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
28
309
|
getUTCMilliseconds(date: DateInput): number;
|
|
310
|
+
/**
|
|
311
|
+
* Returns the minutes (0--59) of the specified date according to universal
|
|
312
|
+
* time (UTC).
|
|
313
|
+
*
|
|
314
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
315
|
+
* @returns {number} The UTC minutes (0--59).
|
|
316
|
+
* @example
|
|
317
|
+
* ```yaml
|
|
318
|
+
* utc_minutes:
|
|
319
|
+
* "@pipe":
|
|
320
|
+
* - ["{a.output.data.date}"]
|
|
321
|
+
* - ["{@date.getUTCMinutes}"]
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
29
324
|
getUTCMinutes(date: DateInput): number;
|
|
325
|
+
/**
|
|
326
|
+
* Returns the month (0--11) of the specified date according to universal
|
|
327
|
+
* time (UTC), where 0 is January and 11 is December.
|
|
328
|
+
*
|
|
329
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
330
|
+
* @returns {number} The UTC month (0 = January, 11 = December).
|
|
331
|
+
* @example
|
|
332
|
+
* ```yaml
|
|
333
|
+
* utc_month:
|
|
334
|
+
* "@pipe":
|
|
335
|
+
* - ["{a.output.data.date}"]
|
|
336
|
+
* - ["{@date.getUTCMonth}"]
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
30
339
|
getUTCMonth(date: DateInput): number;
|
|
340
|
+
/**
|
|
341
|
+
* Returns the seconds (0--59) of the specified date according to universal
|
|
342
|
+
* time (UTC).
|
|
343
|
+
*
|
|
344
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
345
|
+
* @returns {number} The UTC seconds (0--59).
|
|
346
|
+
* @example
|
|
347
|
+
* ```yaml
|
|
348
|
+
* utc_seconds:
|
|
349
|
+
* "@pipe":
|
|
350
|
+
* - ["{a.output.data.date}"]
|
|
351
|
+
* - ["{@date.getUTCSeconds}"]
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
31
354
|
getUTCSeconds(date: DateInput): number;
|
|
355
|
+
/**
|
|
356
|
+
* Sets the milliseconds value (0--999) of a date object according to local
|
|
357
|
+
* time and returns the new timestamp in milliseconds.
|
|
358
|
+
*
|
|
359
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
360
|
+
* @param {number} ms - The milliseconds value to set (0--999).
|
|
361
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
362
|
+
* @example
|
|
363
|
+
* ```yaml
|
|
364
|
+
* new_date:
|
|
365
|
+
* "@pipe":
|
|
366
|
+
* - ["{a.output.data.date}", 123]
|
|
367
|
+
* - ["{@date.setMilliseconds}"]
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
32
370
|
setMilliseconds(date: DateInput, ms: number): number;
|
|
371
|
+
/**
|
|
372
|
+
* Sets the minutes value (0--59) of a date object according to local time,
|
|
373
|
+
* with optional seconds and milliseconds. Returns the new timestamp in
|
|
374
|
+
* milliseconds.
|
|
375
|
+
*
|
|
376
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
377
|
+
* @param {number} minutes - The minutes value to set (0--59).
|
|
378
|
+
* @param {number} [seconds] - Optional seconds value to set (0--59).
|
|
379
|
+
* @param {number} [ms] - Optional milliseconds value to set (0--999).
|
|
380
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
381
|
+
* @example
|
|
382
|
+
* ```yaml
|
|
383
|
+
* new_date:
|
|
384
|
+
* "@pipe":
|
|
385
|
+
* - ["{a.output.data.date}", 45, 30]
|
|
386
|
+
* - ["{@date.setMinutes}"]
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
33
389
|
setMinutes(date: DateInput, minutes: number, seconds?: number, ms?: number): number;
|
|
390
|
+
/**
|
|
391
|
+
* Sets the month value (0--11) of a date object according to local time,
|
|
392
|
+
* with an optional day of the month. Returns the new timestamp in
|
|
393
|
+
* milliseconds.
|
|
394
|
+
*
|
|
395
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
396
|
+
* @param {number} month - The month value to set (0 = January, 11 = December).
|
|
397
|
+
* @param {number} [day] - Optional day of the month to set (1--31).
|
|
398
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
399
|
+
* @example
|
|
400
|
+
* ```yaml
|
|
401
|
+
* new_date:
|
|
402
|
+
* "@pipe":
|
|
403
|
+
* - ["{a.output.data.date}", 7, 15]
|
|
404
|
+
* - ["{@date.setMonth}"]
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
34
407
|
setMonth(date: DateInput, month: number, day?: number): number;
|
|
408
|
+
/**
|
|
409
|
+
* Sets the seconds value (0--59) of a date object according to local time,
|
|
410
|
+
* with optional milliseconds. Returns the new timestamp in milliseconds.
|
|
411
|
+
*
|
|
412
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
413
|
+
* @param {number} seconds - The seconds value to set (0--59).
|
|
414
|
+
* @param {number} [ms] - Optional milliseconds value to set (0--999).
|
|
415
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
416
|
+
* @example
|
|
417
|
+
* ```yaml
|
|
418
|
+
* new_date:
|
|
419
|
+
* "@pipe":
|
|
420
|
+
* - ["{a.output.data.date}", 30, 123]
|
|
421
|
+
* - ["{@date.setSeconds}"]
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
35
424
|
setSeconds(date: DateInput, seconds: number, ms?: number): number;
|
|
425
|
+
/**
|
|
426
|
+
* Sets the date object to the time represented by the number of
|
|
427
|
+
* milliseconds since January 1, 1970, 00:00:00 UTC. Returns the new
|
|
428
|
+
* timestamp.
|
|
429
|
+
*
|
|
430
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
431
|
+
* @param {number} time - The number of milliseconds since the Unix epoch.
|
|
432
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
433
|
+
* @example
|
|
434
|
+
* ```yaml
|
|
435
|
+
* new_date:
|
|
436
|
+
* "@pipe":
|
|
437
|
+
* - ["{a.output.data.date}", 1620000000000]
|
|
438
|
+
* - ["{@date.setTime}"]
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
36
441
|
setTime(date: DateInput, time: number): number;
|
|
442
|
+
/**
|
|
443
|
+
* Sets the day of the month (1--31) of a date object according to
|
|
444
|
+
* universal time (UTC). Returns the new timestamp in milliseconds.
|
|
445
|
+
*
|
|
446
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
447
|
+
* @param {number} day - The UTC day of the month to set (1--31).
|
|
448
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
449
|
+
* @example
|
|
450
|
+
* ```yaml
|
|
451
|
+
* new_date:
|
|
452
|
+
* "@pipe":
|
|
453
|
+
* - ["{a.output.data.date}", 15]
|
|
454
|
+
* - ["{@date.setUTCDate}"]
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
37
457
|
setUTCDate(date: DateInput, day: number): number;
|
|
458
|
+
/**
|
|
459
|
+
* Sets the full year of a date object according to universal time (UTC),
|
|
460
|
+
* with optional month and day parameters. Returns the new timestamp in
|
|
461
|
+
* milliseconds.
|
|
462
|
+
*
|
|
463
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
464
|
+
* @param {number} year - The UTC full year value to set.
|
|
465
|
+
* @param {number} [month] - Optional UTC month to set (0--11).
|
|
466
|
+
* @param {number} [day] - Optional UTC day of the month to set (1--31).
|
|
467
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
468
|
+
* @example
|
|
469
|
+
* ```yaml
|
|
470
|
+
* new_date:
|
|
471
|
+
* "@pipe":
|
|
472
|
+
* - ["{a.output.data.date}", 2025]
|
|
473
|
+
* - ["{@date.setUTCFullYear}"]
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
38
476
|
setUTCFullYear(date: DateInput, year: number, month?: number, day?: number): number;
|
|
477
|
+
/**
|
|
478
|
+
* Sets the hours (0--23) of a date object according to universal time
|
|
479
|
+
* (UTC), with optional minutes, seconds, and milliseconds. Returns the new
|
|
480
|
+
* timestamp in milliseconds.
|
|
481
|
+
*
|
|
482
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
483
|
+
* @param {number} hours - The UTC hours value to set (0--23).
|
|
484
|
+
* @param {number} [minutes] - Optional UTC minutes to set (0--59).
|
|
485
|
+
* @param {number} [seconds] - Optional UTC seconds to set (0--59).
|
|
486
|
+
* @param {number} [ms] - Optional UTC milliseconds to set (0--999).
|
|
487
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
488
|
+
* @example
|
|
489
|
+
* ```yaml
|
|
490
|
+
* new_date:
|
|
491
|
+
* "@pipe":
|
|
492
|
+
* - ["{a.output.data.date}", 18]
|
|
493
|
+
* - ["{@date.setUTCHours}"]
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
39
496
|
setUTCHours(date: DateInput, hours: number, minutes?: number, seconds?: number, ms?: number): number;
|
|
497
|
+
/**
|
|
498
|
+
* Sets the milliseconds value (0--999) of a date object according to
|
|
499
|
+
* universal time (UTC). Returns the new timestamp in milliseconds.
|
|
500
|
+
*
|
|
501
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
502
|
+
* @param {number} ms - The UTC milliseconds value to set (0--999).
|
|
503
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
504
|
+
* @example
|
|
505
|
+
* ```yaml
|
|
506
|
+
* new_date:
|
|
507
|
+
* "@pipe":
|
|
508
|
+
* - ["{a.output.data.date}", 500]
|
|
509
|
+
* - ["{@date.setUTCMilliseconds}"]
|
|
510
|
+
* ```
|
|
511
|
+
*/
|
|
40
512
|
setUTCMilliseconds(date: DateInput, ms: number): number;
|
|
513
|
+
/**
|
|
514
|
+
* Sets the minutes value (0--59) of a date object according to universal
|
|
515
|
+
* time (UTC), with optional seconds and milliseconds. Returns the new
|
|
516
|
+
* timestamp in milliseconds.
|
|
517
|
+
*
|
|
518
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
519
|
+
* @param {number} minutes - The UTC minutes value to set (0--59).
|
|
520
|
+
* @param {number} [seconds] - Optional UTC seconds to set (0--59).
|
|
521
|
+
* @param {number} [ms] - Optional UTC milliseconds to set (0--999).
|
|
522
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
523
|
+
* @example
|
|
524
|
+
* ```yaml
|
|
525
|
+
* new_date:
|
|
526
|
+
* "@pipe":
|
|
527
|
+
* - ["{a.output.data.date}", 45]
|
|
528
|
+
* - ["{@date.setUTCMinutes}"]
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
41
531
|
setUTCMinutes(date: DateInput, minutes: number, seconds?: number, ms?: number): number;
|
|
532
|
+
/**
|
|
533
|
+
* Sets the month value (0--11) of a date object according to universal
|
|
534
|
+
* time (UTC), with an optional day parameter. Returns the new timestamp in
|
|
535
|
+
* milliseconds.
|
|
536
|
+
*
|
|
537
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
538
|
+
* @param {number} month - The UTC month value to set (0 = January, 11 = December).
|
|
539
|
+
* @param {number} [day] - Optional UTC day of the month to set (1--31).
|
|
540
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
541
|
+
* @example
|
|
542
|
+
* ```yaml
|
|
543
|
+
* new_date:
|
|
544
|
+
* "@pipe":
|
|
545
|
+
* - ["{a.output.data.date}", 2]
|
|
546
|
+
* - ["{@date.setUTCMonth}"]
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
42
549
|
setUTCMonth(date: DateInput, month: number, day?: number): number;
|
|
550
|
+
/**
|
|
551
|
+
* Sets the seconds value (0--59) of a date object according to universal
|
|
552
|
+
* time (UTC), with an optional milliseconds parameter. Returns the new
|
|
553
|
+
* timestamp in milliseconds.
|
|
554
|
+
*
|
|
555
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
556
|
+
* @param {number} seconds - The UTC seconds value to set (0--59).
|
|
557
|
+
* @param {number} [ms] - Optional UTC milliseconds to set (0--999).
|
|
558
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
559
|
+
* @example
|
|
560
|
+
* ```yaml
|
|
561
|
+
* new_date:
|
|
562
|
+
* "@pipe":
|
|
563
|
+
* - ["{a.output.data.date}", 30]
|
|
564
|
+
* - ["{@date.setUTCSeconds}"]
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
43
567
|
setUTCSeconds(date: DateInput, seconds: number, ms?: number): number;
|
|
568
|
+
/**
|
|
569
|
+
* Sets the day of the month (1--31) of a date object according to local
|
|
570
|
+
* time. Returns the new timestamp in milliseconds.
|
|
571
|
+
*
|
|
572
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
573
|
+
* @param {number} day - The day of the month to set (1--31).
|
|
574
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
575
|
+
* @example
|
|
576
|
+
* ```yaml
|
|
577
|
+
* new_date:
|
|
578
|
+
* "@pipe":
|
|
579
|
+
* - ["{a.output.data.date}", 15]
|
|
580
|
+
* - ["{@date.setDate}"]
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
44
583
|
setDate(date: DateInput, day: number): number;
|
|
584
|
+
/**
|
|
585
|
+
* Sets the full year of a date object according to local time, with
|
|
586
|
+
* optional month and day parameters. Returns the new timestamp in
|
|
587
|
+
* milliseconds.
|
|
588
|
+
*
|
|
589
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
590
|
+
* @param {number} year - The full year value to set.
|
|
591
|
+
* @param {number} [month] - Optional month to set (0--11).
|
|
592
|
+
* @param {number} [day] - Optional day of the month to set (1--31).
|
|
593
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
594
|
+
* @example
|
|
595
|
+
* ```yaml
|
|
596
|
+
* new_date:
|
|
597
|
+
* "@pipe":
|
|
598
|
+
* - ["{a.output.data.date}", 2024]
|
|
599
|
+
* - ["{@date.setFullYear}"]
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
45
602
|
setFullYear(date: DateInput, year: number, month?: number, day?: number): number;
|
|
603
|
+
/**
|
|
604
|
+
* Sets the hours (0--23) of a date object according to local time, with
|
|
605
|
+
* optional minutes, seconds, and milliseconds. Returns the new timestamp
|
|
606
|
+
* in milliseconds.
|
|
607
|
+
*
|
|
608
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
609
|
+
* @param {number} hours - The hours value to set (0--23).
|
|
610
|
+
* @param {number} [minutes] - Optional minutes to set (0--59).
|
|
611
|
+
* @param {number} [seconds] - Optional seconds to set (0--59).
|
|
612
|
+
* @param {number} [ms] - Optional milliseconds to set (0--999).
|
|
613
|
+
* @returns {number} The updated timestamp in milliseconds since epoch.
|
|
614
|
+
* @example
|
|
615
|
+
* ```yaml
|
|
616
|
+
* new_date:
|
|
617
|
+
* "@pipe":
|
|
618
|
+
* - ["{a.output.data.date}", 15]
|
|
619
|
+
* - ["{@date.setHours}"]
|
|
620
|
+
* ```
|
|
621
|
+
*/
|
|
46
622
|
setHours(date: DateInput, hours: number, minutes?: number, seconds?: number, ms?: number): number;
|
|
623
|
+
/**
|
|
624
|
+
* Returns the date portion of a date object in a human-readable form as a
|
|
625
|
+
* string (e.g., `"Sun Apr 23 2023"`).
|
|
626
|
+
*
|
|
627
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
628
|
+
* @returns {string} The date portion as a human-readable string.
|
|
629
|
+
* @example
|
|
630
|
+
* ```yaml
|
|
631
|
+
* date_string:
|
|
632
|
+
* "@pipe":
|
|
633
|
+
* - ["{a.output.data.date}"]
|
|
634
|
+
* - ["{@date.toDateString}"]
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
47
637
|
toDateString(date: DateInput): string;
|
|
638
|
+
/**
|
|
639
|
+
* Returns the date object as a string in ISO 8601 format
|
|
640
|
+
* (e.g., `"2023-04-23T12:34:56.000Z"`).
|
|
641
|
+
*
|
|
642
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
643
|
+
* @returns {string} The date as an ISO 8601 string.
|
|
644
|
+
* @example
|
|
645
|
+
* ```yaml
|
|
646
|
+
* iso_date:
|
|
647
|
+
* "@pipe":
|
|
648
|
+
* - ["{a.output.data.date}"]
|
|
649
|
+
* - ["{@date.toISOString}"]
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
48
652
|
toISOString(date: DateInput): string;
|
|
653
|
+
/**
|
|
654
|
+
* Returns an ISO date (or current date if none provided) as a string
|
|
655
|
+
* formatted as a compact decimal (e.g., `"20240423123456.789"`). This is
|
|
656
|
+
* useful for sorting dates in string format while keeping the output more
|
|
657
|
+
* human-friendly than `date.valueOf`. Uses the `formatISODate` utility
|
|
658
|
+
* internally.
|
|
659
|
+
*
|
|
660
|
+
* @param {DateInput} [date] - Optional date value (ISO string, milliseconds, or Date). Defaults to now.
|
|
661
|
+
* @returns {string} The date formatted as a compact decimal string.
|
|
662
|
+
* @example
|
|
663
|
+
* ```yaml
|
|
664
|
+
* formatted_date:
|
|
665
|
+
* "@pipe":
|
|
666
|
+
* - ["{a.output.data.date}"]
|
|
667
|
+
* - ["{@date.toISOXString}"]
|
|
668
|
+
* ```
|
|
669
|
+
*/
|
|
49
670
|
toISOXString(date?: DateInput): string;
|
|
671
|
+
/**
|
|
672
|
+
* Returns the date object as a string in a JSON-compatible format, which
|
|
673
|
+
* is similar to the ISO 8601 format.
|
|
674
|
+
*
|
|
675
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
676
|
+
* @returns {string} The date as a JSON-compatible string.
|
|
677
|
+
* @example
|
|
678
|
+
* ```yaml
|
|
679
|
+
* json_date:
|
|
680
|
+
* "@pipe":
|
|
681
|
+
* - ["{a.output.data.date}"]
|
|
682
|
+
* - ["{@date.toJSON}"]
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
50
685
|
toJSON(date: DateInput): string;
|
|
686
|
+
/**
|
|
687
|
+
* Returns the date object as a string formatted according to the given
|
|
688
|
+
* locale(s) and formatting options, showing only the date portion.
|
|
689
|
+
*
|
|
690
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
691
|
+
* @param {string | string[]} [locales] - Optional locale string or array of locale strings (e.g., `"en-US"`).
|
|
692
|
+
* @param {Intl.DateTimeFormatOptions} [options] - Optional formatting options.
|
|
693
|
+
* @returns {string} The localized date string.
|
|
694
|
+
* @example
|
|
695
|
+
* ```yaml
|
|
696
|
+
* localized_date:
|
|
697
|
+
* "@pipe":
|
|
698
|
+
* - ["{a.output.data.date}", "en-US"]
|
|
699
|
+
* - ["{@date.toLocaleDateString}"]
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
51
702
|
toLocaleDateString(date: DateInput, locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
|
703
|
+
/**
|
|
704
|
+
* Returns the date object as a string formatted according to the given
|
|
705
|
+
* locale(s) and formatting options, including both date and time portions.
|
|
706
|
+
*
|
|
707
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
708
|
+
* @param {string | string[]} [locales] - Optional locale string or array of locale strings (e.g., `"en-US"`).
|
|
709
|
+
* @param {Intl.DateTimeFormatOptions} [options] - Optional formatting options.
|
|
710
|
+
* @returns {string} The localized date and time string.
|
|
711
|
+
* @example
|
|
712
|
+
* ```yaml
|
|
713
|
+
* localized_date_time:
|
|
714
|
+
* "@pipe":
|
|
715
|
+
* - ["{a.output.data.date}", "en-US"]
|
|
716
|
+
* - ["{@date.toLocaleString}"]
|
|
717
|
+
* ```
|
|
718
|
+
*/
|
|
52
719
|
toLocaleString(date: DateInput, locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
|
720
|
+
/**
|
|
721
|
+
* Returns the time portion of a date object as a string formatted
|
|
722
|
+
* according to the given locale(s) and formatting options.
|
|
723
|
+
*
|
|
724
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
725
|
+
* @param {string | string[]} [locales] - Optional locale string or array of locale strings (e.g., `"en-US"`).
|
|
726
|
+
* @param {Intl.DateTimeFormatOptions} [options] - Optional formatting options.
|
|
727
|
+
* @returns {string} The localized time string.
|
|
728
|
+
* @example
|
|
729
|
+
* ```yaml
|
|
730
|
+
* localized_time:
|
|
731
|
+
* "@pipe":
|
|
732
|
+
* - ["{a.output.data.date}", "en-US"]
|
|
733
|
+
* - ["{@date.toLocaleTimeString}"]
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
53
736
|
toLocaleTimeString(date: DateInput, locales?: string | string[], options?: Intl.DateTimeFormatOptions): string;
|
|
737
|
+
/**
|
|
738
|
+
* Converts a date object to a string using the default formatting for the
|
|
739
|
+
* local time zone.
|
|
740
|
+
*
|
|
741
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
742
|
+
* @returns {string} The date and time as a string in the local time zone.
|
|
743
|
+
* @example
|
|
744
|
+
* ```yaml
|
|
745
|
+
* date_string:
|
|
746
|
+
* "@pipe":
|
|
747
|
+
* - ["{a.output.data.date}"]
|
|
748
|
+
* - ["{@date.toString}"]
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
54
751
|
toString(date: DateInput): string;
|
|
752
|
+
/**
|
|
753
|
+
* Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC
|
|
754
|
+
* for the given date components. Accepts between two and seven parameters.
|
|
755
|
+
*
|
|
756
|
+
* @param {number} year - The full year (e.g., 2023).
|
|
757
|
+
* @param {number} month - The month (0 = January, 11 = December).
|
|
758
|
+
* @param {number} [date] - Optional day of the month (1--31).
|
|
759
|
+
* @param {number} [hours] - Optional hours (0--23).
|
|
760
|
+
* @param {number} [minutes] - Optional minutes (0--59).
|
|
761
|
+
* @param {number} [seconds] - Optional seconds (0--59).
|
|
762
|
+
* @param {number} [ms] - Optional milliseconds (0--999).
|
|
763
|
+
* @returns {number} Milliseconds since the Unix epoch for the given UTC date components.
|
|
764
|
+
* @example
|
|
765
|
+
* ```yaml
|
|
766
|
+
* milliseconds_since_epoch:
|
|
767
|
+
* "@pipe":
|
|
768
|
+
* - ["{a.output.data.year}", "{a.output.data.month}", "{a.output.data.day}"]
|
|
769
|
+
* - ["{@date.UTC}"]
|
|
770
|
+
* ```
|
|
771
|
+
*/
|
|
55
772
|
UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number;
|
|
773
|
+
/**
|
|
774
|
+
* Returns the numeric value of the specified date object as the number of
|
|
775
|
+
* milliseconds since January 1, 1970, 00:00:00 UTC.
|
|
776
|
+
*
|
|
777
|
+
* @param {DateInput} date - A date value (ISO string, milliseconds, or Date).
|
|
778
|
+
* @returns {number} Milliseconds since the Unix epoch.
|
|
779
|
+
* @example
|
|
780
|
+
* ```yaml
|
|
781
|
+
* milliseconds_since_epoch:
|
|
782
|
+
* "@pipe":
|
|
783
|
+
* - ["{a.output.data.date}"]
|
|
784
|
+
* - ["{@date.valueOf}"]
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
56
787
|
valueOf(date: DateInput): number;
|
|
57
788
|
}
|
|
58
789
|
export { DateHandler };
|