@bitbybit-dev/base 1.2.0 → 1.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 (55) hide show
  1. package/lib/api/GlobalCDNProvider.js +1 -1
  2. package/lib/api/inputs/base-inputs.d.ts +13 -12
  3. package/lib/api/inputs/color-inputs.d.ts +97 -48
  4. package/lib/api/inputs/color-inputs.js +95 -46
  5. package/lib/api/inputs/dates-inputs.d.ts +67 -26
  6. package/lib/api/inputs/dates-inputs.js +57 -16
  7. package/lib/api/inputs/io-inputs.d.ts +13 -15
  8. package/lib/api/inputs/io-inputs.js +7 -8
  9. package/lib/api/inputs/line-inputs.d.ts +88 -33
  10. package/lib/api/inputs/line-inputs.js +61 -11
  11. package/lib/api/inputs/lists-inputs.d.ts +207 -96
  12. package/lib/api/inputs/lists-inputs.js +153 -45
  13. package/lib/api/inputs/logic-inputs.d.ts +52 -22
  14. package/lib/api/inputs/logic-inputs.js +41 -12
  15. package/lib/api/inputs/math-inputs.d.ts +113 -52
  16. package/lib/api/inputs/math-inputs.js +112 -51
  17. package/lib/api/inputs/mesh-inputs.d.ts +30 -11
  18. package/lib/api/inputs/mesh-inputs.js +21 -3
  19. package/lib/api/inputs/point-inputs.d.ts +240 -107
  20. package/lib/api/inputs/point-inputs.js +199 -73
  21. package/lib/api/inputs/polyline-inputs.d.ts +68 -28
  22. package/lib/api/inputs/polyline-inputs.js +48 -13
  23. package/lib/api/inputs/text-inputs.d.ts +117 -46
  24. package/lib/api/inputs/text-inputs.js +111 -41
  25. package/lib/api/inputs/transforms-inputs.d.ts +65 -23
  26. package/lib/api/inputs/transforms-inputs.js +64 -22
  27. package/lib/api/inputs/vector-inputs.d.ts +154 -76
  28. package/lib/api/inputs/vector-inputs.js +132 -57
  29. package/lib/api/models/point/hex-grid-data.d.ts +1 -1
  30. package/lib/api/models/point/hex-grid-data.js +1 -1
  31. package/lib/api/services/color.d.ts +149 -70
  32. package/lib/api/services/color.js +149 -70
  33. package/lib/api/services/dates.d.ts +313 -150
  34. package/lib/api/services/dates.js +313 -150
  35. package/lib/api/services/line.d.ts +138 -68
  36. package/lib/api/services/line.js +138 -68
  37. package/lib/api/services/lists.d.ts +357 -177
  38. package/lib/api/services/lists.js +357 -177
  39. package/lib/api/services/logic.d.ts +98 -45
  40. package/lib/api/services/logic.js +98 -45
  41. package/lib/api/services/math.d.ts +363 -211
  42. package/lib/api/services/math.js +363 -211
  43. package/lib/api/services/mesh.d.ts +73 -31
  44. package/lib/api/services/mesh.js +73 -31
  45. package/lib/api/services/point.d.ts +367 -147
  46. package/lib/api/services/point.js +367 -147
  47. package/lib/api/services/polyline.d.ts +146 -71
  48. package/lib/api/services/polyline.js +146 -71
  49. package/lib/api/services/text.d.ts +320 -165
  50. package/lib/api/services/text.js +320 -165
  51. package/lib/api/services/transforms.d.ts +145 -58
  52. package/lib/api/services/transforms.js +145 -58
  53. package/lib/api/services/vector.d.ts +381 -156
  54. package/lib/api/services/vector.js +381 -156
  55. package/package.json +1 -1
@@ -1,399 +1,562 @@
1
1
  import * as Inputs from "../inputs";
2
2
  /**
3
- * Contains various date methods.
3
+ * Dates and times as JavaScript `Date` values: creating them, reading and setting their parts, and
4
+ * formatting them as text. Months count from 0 (January is 0, December 11) and weekdays from 0
5
+ * (Sunday); days of the month count from 1. Every setter returns a new date and leaves the given
6
+ * one unchanged. Local-time and UTC variants exist for most operations.
4
7
  */
5
8
  export declare class Dates {
6
9
  /**
7
- * Converts date to human-readable date string (excludes time).
8
- * Example: Date(2024,0,15,14,30) → 'Mon Jan 15 2024'
9
- * @param inputs a date
10
- * @returns date as string
10
+ * Formats the date part as text, without the time, in the local time zone.
11
+ *
12
+ * Example: 15 January 2024 at 14:30 -> 'Mon Jan 15 2024'
13
+ * @param inputs - The date
14
+ * @returns The date as text such as 'Mon Jan 15 2024'
11
15
  * @group convert
12
16
  * @shortname date to string
13
17
  * @drawable false
14
18
  */
15
19
  toDateString(inputs: Inputs.Dates.DateDto): string;
16
20
  /**
17
- * Converts date to ISO 8601 format string (standard format for APIs and data interchange).
18
- * Example: Date(2024,0,15,14,30,45) → '2024-01-15T14:30:45.000Z'
19
- * @param inputs a date
20
- * @returns date as string
21
+ * Formats the date and time in the ISO 8601 form used for data exchange, always in UTC.
22
+ *
23
+ * Example: 15 January 2024 at 14:30 -> '2024-01-15T14:30:45.000Z'
24
+ * @param inputs - The date
25
+ * @returns The date as text such as '2024-01-15T14:30:45.000Z'
21
26
  * @group convert
22
27
  * @shortname date to iso string
23
28
  * @drawable false
24
29
  */
25
30
  toISOString(inputs: Inputs.Dates.DateDto): string;
26
31
  /**
27
- * Converts date to JSON-compatible string (same as ISO format, used in JSON.stringify).
28
- * Example: Date(2024,0,15,14,30) → '2024-01-15T14:30:00.000Z'
29
- * @param inputs a date
30
- * @returns date as string
32
+ * Formats the date the way it appears inside JSON, which is the ISO 8601 form in UTC.
33
+ *
34
+ * Example: 15 January 2024 at 14:30 -> '2024-01-15T14:30:00.000Z'
35
+ * @param inputs - The date
36
+ * @returns The date as text such as '2024-01-15T14:30:00.000Z'
31
37
  * @group convert
32
38
  * @shortname date to json
33
39
  * @drawable false
34
40
  */
35
41
  toJSON(inputs: Inputs.Dates.DateDto): string;
36
42
  /**
37
- * Converts date to full locale-specific string (includes date, time, and timezone).
38
- * Example: Date(2024,0,15,14,30) → 'Mon Jan 15 2024 14:30:00 GMT+0000'
39
- * @param inputs a date
40
- * @returns date as string
43
+ * Formats the full date and time as text in the local time zone, with the zone offset.
44
+ *
45
+ * Example: 15 January 2024 at 14:30 -> 'Mon Jan 15 2024 14:30:00 GMT+0000'
46
+ * @param inputs - The date
47
+ * @returns The date and time as text
41
48
  * @group convert
42
49
  * @shortname date to locale string
43
50
  * @drawable false
44
51
  */
45
52
  toString(inputs: Inputs.Dates.DateDto): string;
46
53
  /**
47
- * Converts date to time string (excludes date, includes timezone).
48
- * Example: Date(2024,0,15,14,30,45) → '14:30:45 GMT+0000'
49
- * @param inputs a date
50
- * @returns time as string
54
+ * Formats the time part as text, without the date, in the local time zone with the zone offset.
55
+ *
56
+ * Example: 15 January 2024 at 14:30 -> '14:30:45 GMT+0000'
57
+ * @param inputs - The date
58
+ * @returns The time as text such as '14:30:45 GMT+0000'
51
59
  * @group convert
52
60
  * @shortname date to time string
53
61
  * @drawable false
54
62
  */
55
63
  toTimeString(inputs: Inputs.Dates.DateDto): string;
56
64
  /**
57
- * Converts date to UTC string format (Universal Coordinated Time, no timezone offset).
58
- * Example: Date(2024,0,15,14,30) → 'Mon, 15 Jan 2024 14:30:00 GMT'
59
- * @param inputs a date
60
- * @returns date as utc string
65
+ * Formats the date and time as text in UTC.
66
+ *
67
+ * Example: 15 January 2024 at 14:30 -> 'Mon, 15 Jan 2024 14:30:00 GMT'
68
+ * @param inputs - The date
69
+ * @returns The date and time as UTC text
61
70
  * @group convert
62
71
  * @shortname date to utc string
63
72
  * @drawable false
64
73
  */
65
74
  toUTCString(inputs: Inputs.Dates.DateDto): string;
66
75
  /**
67
- * Returns the current date and time at the moment of execution.
68
- * Example: calling now() → Date object representing current moment (e.g., '2024-01-15T14:30:45')
69
- * @returns date
76
+ * Gives the current date and time at the moment of the call.
77
+ * @returns The current date and time
70
78
  * @group create
71
79
  * @shortname now
72
80
  * @drawable false
73
81
  */
74
82
  now(): Date;
75
83
  /**
76
- * Creates a new date from individual components using local time.
77
- * Month is 0-indexed: 0=January, 11=December.
78
- * Example: year=2024, month=0, day=15, hours=14, minutes=30 → Date(Jan 15, 2024 14:30)
79
- * @param inputs a date
80
- * @returns date
84
+ * Builds a date from its parts, read in the local time zone.
85
+ *
86
+ * The month counts from 0: 0 is January, 11 December. A part outside its range rolls over, so
87
+ * day 32 of January becomes the first of February.
88
+ * Example: year 2024, month 0, day 15, hours 14, minutes 30 -> 15 January 2024 at 14:30 local
89
+ * time
90
+ * @param inputs - The year, month, day, hours, minutes, seconds and milliseconds
91
+ * @returns The date
81
92
  * @group create
82
93
  * @shortname create date
83
94
  * @drawable false
95
+ * @example
96
+ * ```typescript
97
+ * const date = bitbybit.dates.createDate({ year: 2024, month: 0, day: 15, hours: 14, minutes: 30, seconds: 0, milliseconds: 0 });
98
+ * ```
84
99
  */
85
100
  createDate(inputs: Inputs.Dates.CreateDateDto): Date;
86
101
  /**
87
- * Creates a new date from individual components using UTC (ignores timezone).
88
- * Returns milliseconds since Unix epoch (Jan 1, 1970 00:00:00 UTC).
89
- * Example: year=2024, month=0, day=15 → Date representing Jan 15, 2024 00:00 UTC
90
- * @param inputs a date
91
- * @returns date
102
+ * Builds a date from its parts, read as UTC so the local time zone plays no part.
103
+ *
104
+ * The month counts from 0: 0 is January, 11 December. A part outside its range rolls over.
105
+ * Example: year 2024, month 0, day 15 -> 15 January 2024 at 00:00 UTC
106
+ * @param inputs - The year, month, day, hours, minutes, seconds and milliseconds
107
+ * @returns The date
92
108
  * @group create
93
109
  * @shortname create utc date
94
110
  * @drawable false
111
+ * @example
112
+ * ```typescript
113
+ * const date = bitbybit.dates.createDateUTC({ year: 2024, month: 0, day: 15, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 });
114
+ * ```
95
115
  */
96
116
  createDateUTC(inputs: Inputs.Dates.CreateDateDto): Date;
97
117
  /**
98
- * Creates a date from Unix timestamp (milliseconds since Jan 1, 1970 UTC).
99
- * Example: unixTimeStamp=1705329000000 → Date(Jan 15, 2024 14:30:00)
100
- * @param inputs a unix time stamp
101
- * @returns date
118
+ * Builds a date from a Unix timestamp: the number of milliseconds since 1 January 1970 at 00:00
119
+ * UTC.
120
+ *
121
+ * Example: 1705329000000 -> 15 January 2024 at 14:30 UTC
122
+ * @param inputs - The timestamp in milliseconds
123
+ * @returns The date
102
124
  * @group create
103
125
  * @shortname create from unix timestamp
104
126
  * @drawable false
127
+ * @example
128
+ * ```typescript
129
+ * const date = bitbybit.dates.createFromUnixTimeStamp({ unixTimeStamp: 1705329000000 });
130
+ * ```
105
131
  */
106
132
  createFromUnixTimeStamp(inputs: Inputs.Dates.CreateFromUnixTimeStampDto): Date;
107
133
  /**
108
- * Parses a date string and returns Unix timestamp (milliseconds since Jan 1, 1970 UTC).
109
- * Example: dateString='2024-01-15' → 1705276800000
110
- * @param inputs a date string
111
- * @returns the number of milliseconds between that date and midnight, January 1, 1970.
134
+ * Reads a date written as text and gives its Unix timestamp, the milliseconds since 1 January
135
+ * 1970 at 00:00 UTC.
136
+ *
137
+ * ISO 8601 text such as '2024-01-15' or '2024-01-15T14:30:00Z' is read reliably; text that
138
+ * cannot be read gives NaN.
139
+ * Example: '2024-01-15' -> 1705276800000
140
+ * @param inputs - The date as text
141
+ * @returns The timestamp in milliseconds, or NaN when the text is not a date
112
142
  * @group parse
113
143
  * @shortname parse date string
114
144
  * @drawable false
145
+ * @example
146
+ * ```typescript
147
+ * const stamp = bitbybit.dates.parseDate({ dateString: "2024-01-15T14:30:00Z" });
148
+ * ```
115
149
  */
116
150
  parseDate(inputs: Inputs.Dates.DateStringDto): number;
117
151
  /**
118
- * Extracts day of the month from date (1-31) using local time.
119
- * Example: Date(2024,0,15) → 15
120
- * @returns date
152
+ * Reads the day of the month, from 1 to 31, in the local time zone.
153
+ *
154
+ * Example: 15 January 2024 -> 15
155
+ * @param inputs - The date
156
+ * @returns The day of the month
121
157
  * @group get
122
158
  * @shortname get date of month
123
159
  * @drawable false
124
160
  */
125
161
  getDayOfMonth(inputs: Inputs.Dates.DateDto): number;
126
162
  /**
127
- * Extracts day of the week from date (0=Sunday, 6=Saturday) using local time.
128
- * Example: Date(2024,0,15) → 1 (Monday)
129
- * @returns day
163
+ * Reads the day of the week in the local time zone: 0 is Sunday, 6 Saturday.
164
+ *
165
+ * Example: 15 January 2024 -> 1, a Monday
166
+ * @param inputs - The date
167
+ * @returns The weekday from 0 to 6
130
168
  * @group get
131
169
  * @shortname get weekday
132
170
  * @drawable false
133
171
  */
134
172
  getWeekday(inputs: Inputs.Dates.DateDto): number;
135
173
  /**
136
- * Extracts full year from date using local time.
137
- * Example: Date(2024,0,15) → 2024
138
- * @returns year
174
+ * Reads the full year in the local time zone.
175
+ *
176
+ * Example: 15 January 2024 -> 2024
177
+ * @param inputs - The date
178
+ * @returns The year
139
179
  * @group get
140
180
  * @shortname get year
141
181
  * @drawable false
142
182
  */
143
183
  getYear(inputs: Inputs.Dates.DateDto): number;
144
184
  /**
145
- * Extracts month from date (0=January, 11=December) using local time.
146
- * Example: Date(2024,0,15) → 0 (January)
147
- * @returns month
185
+ * Reads the month in the local time zone, counting from 0: 0 is January, 11 December.
186
+ *
187
+ * Example: 15 January 2024 -> 0
188
+ * @param inputs - The date
189
+ * @returns The month from 0 to 11
148
190
  * @group get
149
191
  * @shortname get month
150
192
  * @drawable false
151
193
  */
152
194
  getMonth(inputs: Inputs.Dates.DateDto): number;
153
195
  /**
154
- * Extracts hours from date (0-23) using local time.
155
- * Example: Date(2024,0,15,14,30) → 14
156
- * @returns hours
196
+ * Reads the hour, from 0 to 23, in the local time zone.
197
+ *
198
+ * Example: 14:30 -> 14
199
+ * @param inputs - The date
200
+ * @returns The hour
157
201
  * @group get
158
202
  * @shortname get hours
159
203
  * @drawable false
160
204
  */
161
205
  getHours(inputs: Inputs.Dates.DateDto): number;
162
206
  /**
163
- * Extracts minutes from date (0-59) using local time.
164
- * Example: Date(2024,0,15,14,30) → 30
165
- * @returns minutes
207
+ * Reads the minutes, from 0 to 59, in the local time zone.
208
+ *
209
+ * Example: 14:30 -> 30
210
+ * @param inputs - The date
211
+ * @returns The minutes
166
212
  * @group get
167
213
  * @shortname get minutes
168
214
  * @drawable false
169
215
  */
170
216
  getMinutes(inputs: Inputs.Dates.DateDto): number;
171
217
  /**
172
- * Extracts seconds from date (0-59) using local time.
173
- * Example: Date(2024,0,15,14,30,45) → 45
174
- * @returns seconds
218
+ * Reads the seconds, from 0 to 59, in the local time zone.
219
+ *
220
+ * Example: 14:30:45 -> 45
221
+ * @param inputs - The date
222
+ * @returns The seconds
175
223
  * @group get
176
224
  * @shortname get seconds
177
225
  * @drawable false
178
226
  */
179
227
  getSeconds(inputs: Inputs.Dates.DateDto): number;
180
228
  /**
181
- * Extracts milliseconds from date (0-999) using local time.
182
- * Example: Date(2024,0,15,14,30,45,123) → 123
183
- * @returns milliseconds
229
+ * Reads the milliseconds, from 0 to 999, in the local time zone.
230
+ *
231
+ * Example: 14:30:45.123 -> 123
232
+ * @param inputs - The date
233
+ * @returns The milliseconds
184
234
  * @group get
185
235
  * @shortname get milliseconds
186
236
  * @drawable false
187
237
  */
188
238
  getMilliseconds(inputs: Inputs.Dates.DateDto): number;
189
239
  /**
190
- * Converts date to Unix timestamp (milliseconds since Jan 1, 1970 UTC).
191
- * Example: Date(2024,0,15,14,30) → 1705329000000
192
- * @returns time
240
+ * Gives the date as a Unix timestamp: the milliseconds since 1 January 1970 at 00:00 UTC.
241
+ *
242
+ * Example: 15 January 2024 at 14:30 UTC -> 1705329000000
243
+ * @param inputs - The date
244
+ * @returns The timestamp in milliseconds
193
245
  * @group get
194
246
  * @shortname get time
195
247
  * @drawable false
196
248
  */
197
249
  getTime(inputs: Inputs.Dates.DateDto): number;
198
250
  /**
199
- * Extracts full year from date using UTC (ignores timezone).
200
- * Example: Date(2024,0,15) → 2024
201
- * @returns year
251
+ * Reads the full year in UTC.
252
+ *
253
+ * Example: 15 January 2024 -> 2024
254
+ * @param inputs - The date
255
+ * @returns The year
202
256
  * @group get
203
257
  * @shortname get utc year
204
258
  * @drawable false
205
259
  */
206
260
  getUTCYear(inputs: Inputs.Dates.DateDto): number;
207
261
  /**
208
- * Extracts month from date (0=January, 11=December) using UTC.
209
- * Example: Date.UTC(2024,0,15) → 0 (January)
210
- * @returns month
262
+ * Reads the month in UTC, counting from 0: 0 is January, 11 December.
263
+ *
264
+ * Example: 15 January 2024 -> 0
265
+ * @param inputs - The date
266
+ * @returns The month from 0 to 11
211
267
  * @group get
212
268
  * @shortname get utc month
213
269
  * @drawable false
214
270
  */
215
271
  getUTCMonth(inputs: Inputs.Dates.DateDto): number;
216
272
  /**
217
- * Extracts day of the month from date (1-31) using UTC.
218
- * Example: Date.UTC(2024,0,15) → 15
219
- * @returns day
273
+ * Reads the day of the month, from 1 to 31, in UTC.
274
+ *
275
+ * Example: 15 January 2024 -> 15
276
+ * @param inputs - The date
277
+ * @returns The day of the month
220
278
  * @group get
221
279
  * @shortname get utc day
222
280
  * @drawable false
223
281
  */
224
282
  getUTCDay(inputs: Inputs.Dates.DateDto): number;
225
283
  /**
226
- * Extracts hours from date (0-23) using UTC.
227
- * Example: Date.UTC(2024,0,15,14) → 14
228
- * @returns hours
284
+ * Reads the hour, from 0 to 23, in UTC.
285
+ *
286
+ * Example: 14:00 UTC -> 14
287
+ * @param inputs - The date
288
+ * @returns The hour
229
289
  * @group get
230
290
  * @shortname get utc hours
231
291
  * @drawable false
232
292
  */
233
293
  getUTCHours(inputs: Inputs.Dates.DateDto): number;
234
294
  /**
235
- * Extracts minutes from date (0-59) using UTC.
236
- * Example: Date.UTC(2024,0,15,14,30) → 30
237
- * @returns minutes
295
+ * Reads the minutes, from 0 to 59, in UTC.
296
+ *
297
+ * Example: 14:30 UTC -> 30
298
+ * @param inputs - The date
299
+ * @returns The minutes
238
300
  * @group get
239
301
  * @shortname get utc minutes
240
302
  * @drawable false
241
303
  */
242
304
  getUTCMinutes(inputs: Inputs.Dates.DateDto): number;
243
305
  /**
244
- * Extracts seconds from date (0-59) using UTC.
245
- * Example: Date.UTC(2024,0,15,14,30,45) → 45
246
- * @returns seconds
306
+ * Reads the seconds, from 0 to 59, in UTC.
307
+ *
308
+ * Example: 14:30:45 UTC -> 45
309
+ * @param inputs - The date
310
+ * @returns The seconds
247
311
  * @group get
248
312
  * @shortname get utc seconds
249
313
  * @drawable false
250
314
  */
251
315
  getUTCSeconds(inputs: Inputs.Dates.DateDto): number;
252
316
  /**
253
- * Extracts milliseconds from date (0-999) using UTC.
254
- * Example: Date.UTC(2024,0,15,14,30,45,123) → 123
255
- * @returns milliseconds
317
+ * Reads the milliseconds, from 0 to 999, in UTC.
318
+ *
319
+ * Example: 14:30:45.123 UTC -> 123
320
+ * @param inputs - The date
321
+ * @returns The milliseconds
256
322
  * @group get
257
323
  * @shortname get utc milliseconds
258
324
  * @drawable false
259
325
  */
260
326
  getUTCMilliseconds(inputs: Inputs.Dates.DateDto): number;
261
327
  /**
262
- * Creates new date with modified year (returns new date, original unchanged).
263
- * Example: Date(2024,0,15) with year=2025 → Date(2025,0,15)
264
- * @param inputs a date and the year
265
- * @returns date
328
+ * Makes a copy of the date with another year, in the local time zone. The given date is not
329
+ * changed.
330
+ *
331
+ * Example: 15 January 2024 with year 2025 -> 15 January 2025
332
+ * @param inputs - The date and the year
333
+ * @returns A new date with the year changed
266
334
  * @group set
267
335
  * @shortname set year
268
336
  * @drawable false
269
- * */
337
+ * @example
338
+ * ```typescript
339
+ * const changed = bitbybit.dates.setYear({ date: bitbybit.dates.now(), year: 2025 });
340
+ * ```
341
+ */
270
342
  setYear(inputs: Inputs.Dates.DateYearDto): Date;
271
343
  /**
272
- * Creates new date with modified month (0=January, 11=December, returns new date).
273
- * Example: Date(2024,0,15) with month=5 → Date(2024,5,15) (June 15)
274
- * @param inputs a date and the month
275
- * @returns date
344
+ * Makes a copy of the date with another month, in the local time zone; months count from 0. The
345
+ * given date is not changed.
346
+ *
347
+ * Example: 15 January 2024 with month 5 -> 15 June 2024
348
+ * @param inputs - The date and the month from 0 to 11
349
+ * @returns A new date with the month changed
276
350
  * @group set
277
351
  * @shortname set month
278
352
  * @drawable false
279
- * */
353
+ * @example
354
+ * ```typescript
355
+ * const changed = bitbybit.dates.setMonth({ date: bitbybit.dates.now(), month: 5 });
356
+ * ```
357
+ */
280
358
  setMonth(inputs: Inputs.Dates.DateMonthDto): Date;
281
359
  /**
282
- * Creates new date with modified day of month (1-31, returns new date).
283
- * Example: Date(2024,0,15) with day=20 → Date(2024,0,20)
284
- * @param inputs a date and the day
285
- * @returns date
360
+ * Makes a copy of the date with another day of the month, in the local time zone. The given
361
+ * date is not changed.
362
+ *
363
+ * Example: 15 January 2024 with day 20 -> 20 January 2024
364
+ * @param inputs - The date and the day from 1 to 31
365
+ * @returns A new date with the day changed
286
366
  * @group set
287
367
  * @shortname set day of month
288
368
  * @drawable false
369
+ * @example
370
+ * ```typescript
371
+ * const changed = bitbybit.dates.setDayOfMonth({ date: bitbybit.dates.now(), day: 20 });
372
+ * ```
289
373
  */
290
374
  setDayOfMonth(inputs: Inputs.Dates.DateDayDto): Date;
291
375
  /**
292
- * Sets the hour value in the Date object using local time.
293
- * @param inputs a date and the hours
294
- * @returns date
376
+ * Makes a copy of the date with another hour, in the local time zone. The given date is not
377
+ * changed.
378
+ *
379
+ * Example: 14:30 with hours 9 -> 09:30
380
+ * @param inputs - The date and the hour from 0 to 23
381
+ * @returns A new date with the hour changed
295
382
  * @group set
296
383
  * @shortname set hours
297
384
  * @drawable false
298
- * */
385
+ * @example
386
+ * ```typescript
387
+ * const changed = bitbybit.dates.setHours({ date: bitbybit.dates.now(), hours: 9 });
388
+ * ```
389
+ */
299
390
  setHours(inputs: Inputs.Dates.DateHoursDto): Date;
300
391
  /**
301
- * Sets the minutes value in the Date object using local time.
302
- * @param inputs a date and the minutes
303
- * @returns date
392
+ * Makes a copy of the date with other minutes, in the local time zone. The given date is not
393
+ * changed.
394
+ *
395
+ * Example: 14:30 with minutes 45 -> 14:45
396
+ * @param inputs - The date and the minutes from 0 to 59
397
+ * @returns A new date with the minutes changed
304
398
  * @group set
305
399
  * @shortname set minutes
306
400
  * @drawable false
307
- * */
401
+ * @example
402
+ * ```typescript
403
+ * const changed = bitbybit.dates.setMinutes({ date: bitbybit.dates.now(), minutes: 45 });
404
+ * ```
405
+ */
308
406
  setMinutes(inputs: Inputs.Dates.DateMinutesDto): Date;
309
407
  /**
310
- * Sets the seconds value in the Date object using local time.
311
- * @param inputs a date and the seconds
312
- * @returns date
408
+ * Makes a copy of the date with other seconds, in the local time zone. The given date is not
409
+ * changed.
410
+ *
411
+ * Example: 14:30:00 with seconds 30 -> 14:30:30
412
+ * @param inputs - The date and the seconds from 0 to 59
413
+ * @returns A new date with the seconds changed
313
414
  * @group set
314
415
  * @shortname set seconds
315
416
  * @drawable false
417
+ * @example
418
+ * ```typescript
419
+ * const changed = bitbybit.dates.setSeconds({ date: bitbybit.dates.now(), seconds: 30 });
420
+ * ```
316
421
  */
317
422
  setSeconds(inputs: Inputs.Dates.DateSecondsDto): Date;
318
423
  /**
319
- * Sets the milliseconds value in the Date object using local time.
320
- * @param inputs a date and the milliseconds
321
- * @returns date
424
+ * Makes a copy of the date with other milliseconds, in the local time zone. The given date is
425
+ * not changed.
426
+ *
427
+ * Example: 14:30:00.000 with milliseconds 500 -> 14:30:00.500
428
+ * @param inputs - The date and the milliseconds from 0 to 999
429
+ * @returns A new date with the milliseconds changed
322
430
  * @group set
323
431
  * @shortname set milliseconds
324
432
  * @drawable false
433
+ * @example
434
+ * ```typescript
435
+ * const changed = bitbybit.dates.setMilliseconds({ date: bitbybit.dates.now(), milliseconds: 500 });
436
+ * ```
325
437
  */
326
438
  setMilliseconds(inputs: Inputs.Dates.DateMillisecondsDto): Date;
327
439
  /**
328
- * Sets the date and time value in the Date object.
329
- * @param inputs a date and the time
330
- * @returns date
440
+ * Makes a copy of the date moved to a Unix timestamp, the milliseconds since 1 January 1970 at
441
+ * 00:00 UTC. The given date is not changed.
442
+ *
443
+ * Example: any date with time 0 -> 1 January 1970 at 00:00 UTC
444
+ * @param inputs - The date and the timestamp in milliseconds
445
+ * @returns A new date with the timestamp changed
331
446
  * @group set
332
447
  * @shortname set time
333
448
  * @drawable false
449
+ * @example
450
+ * ```typescript
451
+ * const changed = bitbybit.dates.setTime({ date: bitbybit.dates.now(), time: 1705329000000 });
452
+ * ```
334
453
  */
335
454
  setTime(inputs: Inputs.Dates.DateTimeDto): Date;
336
455
  /**
337
- * Sets the year value in the Date object using Universal Coordinated Time (UTC).
338
- * @param inputs a date and the year
339
- * @returns date
456
+ * Makes a copy of the date with another year, in UTC. The given date is not changed.
457
+ *
458
+ * Example: 15 January 2024 with year 2025 -> 15 January 2025
459
+ * @param inputs - The date and the year
460
+ * @returns A new date with the year changed
340
461
  * @group set
341
462
  * @shortname set utc year
342
463
  * @drawable false
343
- * */
464
+ * @example
465
+ * ```typescript
466
+ * const changed = bitbybit.dates.setUTCYear({ date: bitbybit.dates.now(), year: 2025 });
467
+ * ```
468
+ */
344
469
  setUTCYear(inputs: Inputs.Dates.DateYearDto): Date;
345
470
  /**
346
- * Sets the month value in the Date object using Universal Coordinated Time (UTC).
347
- * @param inputs a date and the month
348
- * @returns date
471
+ * Makes a copy of the date with another month, in UTC; months count from 0. The given date is
472
+ * not changed.
473
+ *
474
+ * Example: 15 January 2024 with month 5 -> 15 June 2024
475
+ * @param inputs - The date and the month from 0 to 11
476
+ * @returns A new date with the month changed
349
477
  * @group set
350
478
  * @shortname set utc month
351
479
  * @drawable false
352
- * */
480
+ * @example
481
+ * ```typescript
482
+ * const changed = bitbybit.dates.setUTCMonth({ date: bitbybit.dates.now(), month: 5 });
483
+ * ```
484
+ */
353
485
  setUTCMonth(inputs: Inputs.Dates.DateMonthDto): Date;
354
486
  /**
355
- * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
356
- * @param inputs a date and the day
357
- * @returns date
487
+ * Makes a copy of the date with another day of the month, in UTC. The given date is not
488
+ * changed.
489
+ *
490
+ * Example: 15 January 2024 with day 20 -> 20 January 2024
491
+ * @param inputs - The date and the day from 1 to 31
492
+ * @returns A new date with the day changed
358
493
  * @group set
359
494
  * @shortname set utc day
360
495
  * @drawable false
496
+ * @example
497
+ * ```typescript
498
+ * const changed = bitbybit.dates.setUTCDay({ date: bitbybit.dates.now(), day: 20 });
499
+ * ```
361
500
  */
362
501
  setUTCDay(inputs: Inputs.Dates.DateDayDto): Date;
363
502
  /**
364
- * Sets the hours value in the Date object using Universal Coordinated Time (UTC).
365
- * @param inputs a date and the hours
366
- * @returns date
503
+ * Makes a copy of the date with another hour, in UTC. The given date is not changed.
504
+ *
505
+ * Example: 14:30 UTC with hours 9 -> 09:30 UTC
506
+ * @param inputs - The date and the hour from 0 to 23
507
+ * @returns A new date with the hour changed
367
508
  * @group set
368
509
  * @shortname set utc hours
369
510
  * @drawable false
370
- * */
511
+ * @example
512
+ * ```typescript
513
+ * const changed = bitbybit.dates.setUTCHours({ date: bitbybit.dates.now(), hours: 9 });
514
+ * ```
515
+ */
371
516
  setUTCHours(inputs: Inputs.Dates.DateHoursDto): Date;
372
517
  /**
373
- * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
374
- * @param inputs a date and the minutes
375
- * @returns date
518
+ * Makes a copy of the date with other minutes, in UTC. The given date is not changed.
519
+ *
520
+ * Example: 14:30 UTC with minutes 45 -> 14:45 UTC
521
+ * @param inputs - The date and the minutes from 0 to 59
522
+ * @returns A new date with the minutes changed
376
523
  * @group set
377
524
  * @shortname set utc minutes
378
525
  * @drawable false
379
- * */
526
+ * @example
527
+ * ```typescript
528
+ * const changed = bitbybit.dates.setUTCMinutes({ date: bitbybit.dates.now(), minutes: 45 });
529
+ * ```
530
+ */
380
531
  setUTCMinutes(inputs: Inputs.Dates.DateMinutesDto): Date;
381
532
  /**
382
- * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
383
- * @param inputs a date and the seconds
384
- * @returns date
533
+ * Makes a copy of the date with other seconds, in UTC. The given date is not changed.
534
+ *
535
+ * Example: 14:30:00 UTC with seconds 30 -> 14:30:30 UTC
536
+ * @param inputs - The date and the seconds from 0 to 59
537
+ * @returns A new date with the seconds changed
385
538
  * @group set
386
539
  * @shortname set utc seconds
387
540
  * @drawable false
541
+ * @example
542
+ * ```typescript
543
+ * const changed = bitbybit.dates.setUTCSeconds({ date: bitbybit.dates.now(), seconds: 30 });
544
+ * ```
388
545
  */
389
546
  setUTCSeconds(inputs: Inputs.Dates.DateSecondsDto): Date;
390
547
  /**
391
- * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
392
- * @param inputs a date and the milliseconds
393
- * @returns date
548
+ * Makes a copy of the date with other milliseconds, in UTC. The given date is not changed.
549
+ *
550
+ * Example: 14:30:00.000 UTC with milliseconds 500 -> 14:30:00.500 UTC
551
+ * @param inputs - The date and the milliseconds from 0 to 999
552
+ * @returns A new date with the milliseconds changed
394
553
  * @group set
395
554
  * @shortname set utc milliseconds
396
555
  * @drawable false
556
+ * @example
557
+ * ```typescript
558
+ * const changed = bitbybit.dates.setUTCMilliseconds({ date: bitbybit.dates.now(), milliseconds: 500 });
559
+ * ```
397
560
  */
398
561
  setUTCMilliseconds(inputs: Inputs.Dates.DateMillisecondsDto): Date;
399
562
  }