@dereekb/dbx-components-mcp 13.10.9 → 13.11.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.
@@ -0,0 +1,864 @@
1
+ {
2
+ "version": 1,
3
+ "source": "@dereekb/date",
4
+ "module": "@dereekb/date",
5
+ "generatedAt": "1970-01-01T00:00:00.000Z",
6
+ "generator": "@dereekb/dbx-components-mcp/scripts/generate-manifests.mjs",
7
+ "entries": [
8
+ {
9
+ "slug": "date-duration-span-end-date",
10
+ "name": "dateDurationSpanEndDate",
11
+ "kind": "function",
12
+ "category": "date",
13
+ "module": "@dereekb/date",
14
+ "subpath": "date/date.duration",
15
+ "signature": "dateDurationSpanEndDate(span: DateDurationSpan): Date",
16
+ "description": "Computes the end date for a duration span by adding the duration to the start time.",
17
+ "params": [
18
+ {
19
+ "name": "span",
20
+ "type": "DateDurationSpan",
21
+ "description": "- the duration span to compute the end for",
22
+ "optional": false
23
+ }
24
+ ],
25
+ "returns": "the date when the span ends",
26
+ "tags": [
27
+ "date",
28
+ "duration",
29
+ "span",
30
+ "end",
31
+ "compute",
32
+ "time",
33
+ "datedurationspanenddate"
34
+ ],
35
+ "example": "const span = { startsAt: new Date('2024-01-01T10:00:00Z'), duration: 60 };\ndateDurationSpanEndDate(span); // 2024-01-01T11:00:00Z",
36
+ "relatedSlugs": [
37
+ "duration-span-to-date-range",
38
+ "duration-span-from-date-range"
39
+ ]
40
+ },
41
+ {
42
+ "slug": "duration-span-to-date-range",
43
+ "name": "durationSpanToDateRange",
44
+ "kind": "function",
45
+ "category": "date",
46
+ "module": "@dereekb/date",
47
+ "subpath": "date/date.duration",
48
+ "signature": "durationSpanToDateRange(span: DateDurationSpan): DateRange",
49
+ "description": "Converts a {@link DateDurationSpan} to a {@link DateRange} with start and end dates.",
50
+ "params": [
51
+ {
52
+ "name": "span",
53
+ "type": "DateDurationSpan",
54
+ "description": "- the duration span to convert",
55
+ "optional": false
56
+ }
57
+ ],
58
+ "returns": "a date range from startsAt to startsAt + duration",
59
+ "tags": [
60
+ "date",
61
+ "duration",
62
+ "span",
63
+ "range",
64
+ "convert",
65
+ "to",
66
+ "durationspantodaterange"
67
+ ],
68
+ "relatedSlugs": [
69
+ "date-duration-span-end-date",
70
+ "duration-span-from-date-range"
71
+ ]
72
+ },
73
+ {
74
+ "slug": "duration-span-from-date-range",
75
+ "name": "durationSpanFromDateRange",
76
+ "kind": "function",
77
+ "category": "date",
78
+ "module": "@dereekb/date",
79
+ "subpath": "date/date.duration",
80
+ "signature": "durationSpanFromDateRange(dateRange: DateRange): DateDurationSpan",
81
+ "description": "Creates a {@link DateDurationSpan} from a {@link DateRange} by computing the duration in minutes between start and end.",
82
+ "params": [
83
+ {
84
+ "name": "dateRange",
85
+ "type": "DateRange",
86
+ "description": "- the date range to convert",
87
+ "optional": false
88
+ }
89
+ ],
90
+ "returns": "a duration span with the range's start as startsAt",
91
+ "tags": [
92
+ "date",
93
+ "duration",
94
+ "span",
95
+ "range",
96
+ "convert",
97
+ "minutes",
98
+ "from",
99
+ "durationspanfromdaterange"
100
+ ],
101
+ "relatedSlugs": [
102
+ "duration-span-to-date-range",
103
+ "date-duration-span-end-date"
104
+ ]
105
+ },
106
+ {
107
+ "slug": "format-date-range-function",
108
+ "name": "formatDateRangeFunction",
109
+ "kind": "factory",
110
+ "category": "date",
111
+ "module": "@dereekb/date",
112
+ "subpath": "date/date.format",
113
+ "signature": "formatDateRangeFunction(inputConfig: FormatDateRangeFunctionConfigInput): FormatDateRangeFunction",
114
+ "description": "Creates a reusable {@link FormatDateRangeFunction} from the given config or format function.\n\nUseful when the same range formatting logic needs to be applied repeatedly with consistent settings.",
115
+ "params": [
116
+ {
117
+ "name": "inputConfig",
118
+ "type": "FormatDateRangeFunctionConfigInput",
119
+ "description": "- format function or full configuration",
120
+ "optional": false
121
+ }
122
+ ],
123
+ "returns": "a reusable function that formats date ranges into strings",
124
+ "tags": [
125
+ "date",
126
+ "format",
127
+ "range",
128
+ "string",
129
+ "time",
130
+ "factory",
131
+ "function",
132
+ "formatdaterangefunction"
133
+ ],
134
+ "example": "import { formatDateRangeFunction, formatToTimeString } from '@dereekb/date';\n\nconst formatRange = formatDateRangeFunction({\n format: formatToTimeString,\n separator: 'to',\n simplifySameDate: true\n});\n\nconst result = formatRange({ start: new Date('2024-01-15T09:00:00'), end: new Date('2024-01-15T17:00:00') });\n// \"9:00 AM to 5:00 PM\"",
135
+ "relatedSlugs": [
136
+ "format-date-range"
137
+ ]
138
+ },
139
+ {
140
+ "slug": "format-date-range",
141
+ "name": "formatDateRange",
142
+ "kind": "function",
143
+ "category": "date",
144
+ "module": "@dereekb/date",
145
+ "subpath": "date/date.format",
146
+ "signature": "formatDateRange(range: DateRange, inputConfig: FormatDateRangeFunctionConfigInput, separator?: string): string",
147
+ "description": "Convenience function that formats a date range in a single call without creating a reusable function.",
148
+ "params": [
149
+ {
150
+ "name": "range",
151
+ "type": "DateRange",
152
+ "description": "- date range to format",
153
+ "optional": false
154
+ },
155
+ {
156
+ "name": "inputConfig",
157
+ "type": "FormatDateRangeFunctionConfigInput",
158
+ "description": "- format function or full configuration",
159
+ "optional": false
160
+ },
161
+ {
162
+ "name": "separator",
163
+ "type": "string",
164
+ "description": "- optional separator override when inputConfig is a function",
165
+ "optional": true
166
+ }
167
+ ],
168
+ "returns": "the formatted date range string",
169
+ "tags": [
170
+ "date",
171
+ "format",
172
+ "range",
173
+ "string",
174
+ "time",
175
+ "formatdaterange"
176
+ ],
177
+ "example": "import { formatDateRange, formatToTimeString } from '@dereekb/date';\n\nconst result = formatDateRange(\n { start: new Date('2024-01-15T09:00:00'), end: new Date('2024-01-15T17:00:00') },\n formatToTimeString\n);\n// \"9:00 AM - 5:00 PM\"",
178
+ "relatedSlugs": [
179
+ "format-date-range-function",
180
+ "format-to-time-range-string"
181
+ ]
182
+ },
183
+ {
184
+ "slug": "format-date-range-distance",
185
+ "name": "formatDateRangeDistance",
186
+ "kind": "function",
187
+ "category": "date",
188
+ "module": "@dereekb/date",
189
+ "subpath": "date/date.format",
190
+ "signature": "formatDateRangeDistance(range: DateRange, inputConfig?: FormatDateRangeDistanceFunctionConfig): string",
191
+ "description": "Convenience function that computes the human-readable distance for a date range in a single call.",
192
+ "params": [
193
+ {
194
+ "name": "range",
195
+ "type": "DateRange",
196
+ "description": "- date range to compute distance for",
197
+ "optional": false
198
+ },
199
+ {
200
+ "name": "inputConfig",
201
+ "type": "FormatDateRangeDistanceFunctionConfig",
202
+ "description": "- optional distance formatting configuration",
203
+ "optional": true
204
+ }
205
+ ],
206
+ "returns": "the human-readable distance string",
207
+ "tags": [
208
+ "date",
209
+ "format",
210
+ "distance",
211
+ "range",
212
+ "human",
213
+ "duration",
214
+ "since",
215
+ "ago",
216
+ "formatdaterangedistance"
217
+ ],
218
+ "example": "import { formatDateRangeDistance } from '@dereekb/date';\n\nconst result = formatDateRangeDistance(\n { start: new Date('2024-01-15T09:00:00'), end: new Date('2024-01-17T09:00:00') },\n { addSuffix: true }\n);\n// \"in 2 days\"",
219
+ "relatedSlugs": [
220
+ "format-date-range-distance-function",
221
+ "format-date-distance"
222
+ ]
223
+ },
224
+ {
225
+ "slug": "date-range-days-count",
226
+ "name": "dateRangeDaysCount",
227
+ "kind": "function",
228
+ "category": "date",
229
+ "module": "@dereekb/date",
230
+ "subpath": "date/date.range",
231
+ "signature": "dateRangeDaysCount(dateRange: DateRange): number",
232
+ "description": "Counts the total number of calendar days spanned by the range, inclusive of both endpoints.\nAlways returns at least 1, even for same-day ranges.",
233
+ "params": [
234
+ {
235
+ "name": "dateRange",
236
+ "type": "DateRange",
237
+ "description": "- the date range to measure",
238
+ "optional": false
239
+ }
240
+ ],
241
+ "returns": "the number of days in the range, inclusive",
242
+ "tags": [
243
+ "date",
244
+ "range",
245
+ "days",
246
+ "count",
247
+ "duration",
248
+ "span",
249
+ "length",
250
+ "daterangedayscount"
251
+ ],
252
+ "example": "const range = { start: new Date('2024-01-01'), end: new Date('2024-01-03') };\ndateRangeDaysCount(range); // 3",
253
+ "relatedSlugs": [
254
+ "is-date-range",
255
+ "is-same-date-range"
256
+ ]
257
+ },
258
+ {
259
+ "slug": "is-date-range",
260
+ "name": "isDateRange",
261
+ "kind": "function",
262
+ "category": "date",
263
+ "module": "@dereekb/date",
264
+ "subpath": "date/date.range",
265
+ "signature": "isDateRange(input: unknown): input is DateRange",
266
+ "description": "Type guard to check if a value is a valid {@link DateRange} with both start and end as Date objects.",
267
+ "params": [
268
+ {
269
+ "name": "input",
270
+ "type": "unknown",
271
+ "description": "- the value to check",
272
+ "optional": false
273
+ }
274
+ ],
275
+ "returns": "true if the value has valid Date `start` and `end` properties",
276
+ "tags": [
277
+ "date",
278
+ "range",
279
+ "type-guard",
280
+ "check",
281
+ "validate",
282
+ "is",
283
+ "isdaterange"
284
+ ],
285
+ "example": "isDateRange({ start: new Date(), end: new Date() }); // true\nisDateRange({ start: new Date() }); // false\nisDateRange('not-a-range'); // false",
286
+ "relatedSlugs": [
287
+ "is-date-range-start",
288
+ "date-range-days-count"
289
+ ]
290
+ },
291
+ {
292
+ "slug": "is-same-date-range",
293
+ "name": "isSameDateRange",
294
+ "kind": "function",
295
+ "category": "date",
296
+ "module": "@dereekb/date",
297
+ "subpath": "date/date.range",
298
+ "signature": "isSameDateRange(a: Maybe<Partial<DateRange>>, b: Maybe<Partial<DateRange>>): boolean",
299
+ "description": "Compares two date ranges for exact millisecond equality on both start and end.\nReturns true if both are nullish.",
300
+ "params": [
301
+ {
302
+ "name": "a",
303
+ "type": "Maybe<Partial<DateRange>>",
304
+ "description": "- first date range to compare",
305
+ "optional": false
306
+ },
307
+ {
308
+ "name": "b",
309
+ "type": "Maybe<Partial<DateRange>>",
310
+ "description": "- second date range to compare",
311
+ "optional": false
312
+ }
313
+ ],
314
+ "returns": "true if both ranges are equal or both are nullish",
315
+ "tags": [
316
+ "date",
317
+ "range",
318
+ "equal",
319
+ "equality",
320
+ "same",
321
+ "compare",
322
+ "is",
323
+ "issamedaterange"
324
+ ],
325
+ "example": "const a = { start: new Date('2024-01-01'), end: new Date('2024-01-31') };\nconst b = { start: new Date('2024-01-01'), end: new Date('2024-01-31') };\nisSameDateRange(a, b); // true\nisSameDateRange(null, null); // true",
326
+ "relatedSlugs": [
327
+ "is-same-date-day-range",
328
+ "is-date-range"
329
+ ]
330
+ },
331
+ {
332
+ "slug": "is-date",
333
+ "name": "isDate",
334
+ "kind": "function",
335
+ "category": "date",
336
+ "module": "@dereekb/date",
337
+ "subpath": "date/date",
338
+ "signature": "isDate(input: unknown): input is Date",
339
+ "description": "Type guard that checks whether the input is a Date instance.",
340
+ "params": [
341
+ {
342
+ "name": "input",
343
+ "type": "unknown",
344
+ "description": "- value to check",
345
+ "optional": false
346
+ }
347
+ ],
348
+ "returns": "whether the input is a Date",
349
+ "tags": [
350
+ "date",
351
+ "type-guard",
352
+ "check",
353
+ "instance",
354
+ "is",
355
+ "isdate"
356
+ ],
357
+ "example": "isDate(new Date()); // true\nisDate('2020-01-01'); // false"
358
+ },
359
+ {
360
+ "slug": "ms-to-minutes",
361
+ "name": "msToMinutes",
362
+ "kind": "function",
363
+ "category": "date",
364
+ "module": "@dereekb/date",
365
+ "subpath": "date/date",
366
+ "signature": "msToMinutes(milliseconds: number): Minutes",
367
+ "description": "Converts milliseconds to minutes.",
368
+ "params": [
369
+ {
370
+ "name": "milliseconds",
371
+ "type": "number",
372
+ "description": "- duration in milliseconds",
373
+ "optional": false
374
+ }
375
+ ],
376
+ "returns": "equivalent duration in minutes",
377
+ "tags": [
378
+ "date",
379
+ "time",
380
+ "milliseconds",
381
+ "minutes",
382
+ "convert",
383
+ "duration",
384
+ "ms",
385
+ "to",
386
+ "mstominutes"
387
+ ],
388
+ "example": "msToMinutes(60000); // 1\nmsToMinutes(120000); // 2",
389
+ "relatedSlugs": [
390
+ "ms-to-seconds",
391
+ "hours-to-ms",
392
+ "minutes-to-ms"
393
+ ]
394
+ },
395
+ {
396
+ "slug": "ms-to-seconds",
397
+ "name": "msToSeconds",
398
+ "kind": "function",
399
+ "category": "date",
400
+ "module": "@dereekb/date",
401
+ "subpath": "date/date",
402
+ "signature": "msToSeconds(milliseconds: number): Seconds",
403
+ "description": "Converts milliseconds to seconds.",
404
+ "params": [
405
+ {
406
+ "name": "milliseconds",
407
+ "type": "number",
408
+ "description": "- duration in milliseconds",
409
+ "optional": false
410
+ }
411
+ ],
412
+ "returns": "equivalent duration in seconds",
413
+ "tags": [
414
+ "date",
415
+ "time",
416
+ "milliseconds",
417
+ "seconds",
418
+ "convert",
419
+ "duration",
420
+ "ms",
421
+ "to",
422
+ "mstoseconds"
423
+ ],
424
+ "example": "msToSeconds(1000); // 1\nmsToSeconds(2500); // 2.5",
425
+ "relatedSlugs": [
426
+ "ms-to-minutes",
427
+ "hours-to-ms",
428
+ "minutes-to-ms"
429
+ ]
430
+ },
431
+ {
432
+ "slug": "hours-to-ms",
433
+ "name": "hoursToMs",
434
+ "kind": "function",
435
+ "category": "date",
436
+ "module": "@dereekb/date",
437
+ "subpath": "date/date",
438
+ "signature": "hoursToMs(hours?: number): Minutes",
439
+ "description": "Converts hours to milliseconds.",
440
+ "params": [
441
+ {
442
+ "name": "hours",
443
+ "type": "number",
444
+ "description": "- number of hours (defaults to 1)",
445
+ "optional": true
446
+ }
447
+ ],
448
+ "returns": "equivalent duration in milliseconds",
449
+ "tags": [
450
+ "date",
451
+ "time",
452
+ "hours",
453
+ "milliseconds",
454
+ "convert",
455
+ "duration",
456
+ "to",
457
+ "ms",
458
+ "hourstoms"
459
+ ],
460
+ "example": "hoursToMs(1); // 3600000\nhoursToMs(2); // 7200000",
461
+ "relatedSlugs": [
462
+ "minutes-to-ms",
463
+ "ms-to-minutes"
464
+ ]
465
+ },
466
+ {
467
+ "slug": "minutes-to-ms",
468
+ "name": "minutesToMs",
469
+ "kind": "function",
470
+ "category": "date",
471
+ "module": "@dereekb/date",
472
+ "subpath": "date/date",
473
+ "signature": "minutesToMs(minutes?: number): Minutes",
474
+ "description": "Converts minutes to milliseconds.",
475
+ "params": [
476
+ {
477
+ "name": "minutes",
478
+ "type": "number",
479
+ "description": "- number of minutes (defaults to 1)",
480
+ "optional": true
481
+ }
482
+ ],
483
+ "returns": "equivalent duration in milliseconds",
484
+ "tags": [
485
+ "date",
486
+ "time",
487
+ "minutes",
488
+ "milliseconds",
489
+ "convert",
490
+ "duration",
491
+ "to",
492
+ "ms",
493
+ "minutestoms"
494
+ ],
495
+ "example": "minutesToMs(1); // 60000\nminutesToMs(5); // 300000",
496
+ "relatedSlugs": [
497
+ "hours-to-ms",
498
+ "ms-to-minutes"
499
+ ]
500
+ },
501
+ {
502
+ "slug": "days-to-minutes",
503
+ "name": "daysToMinutes",
504
+ "kind": "function",
505
+ "category": "date",
506
+ "module": "@dereekb/date",
507
+ "subpath": "date/date",
508
+ "signature": "daysToMinutes(days?: number): Minutes",
509
+ "description": "Converts days to minutes.",
510
+ "params": [
511
+ {
512
+ "name": "days",
513
+ "type": "number",
514
+ "description": "- number of days (defaults to 1)",
515
+ "optional": true
516
+ }
517
+ ],
518
+ "returns": "equivalent duration in minutes",
519
+ "tags": [
520
+ "date",
521
+ "time",
522
+ "days",
523
+ "minutes",
524
+ "convert",
525
+ "duration",
526
+ "to",
527
+ "daystominutes"
528
+ ],
529
+ "example": "daysToMinutes(1); // 1440\ndaysToMinutes(7); // 10080",
530
+ "relatedSlugs": [
531
+ "minutes-to-ms",
532
+ "hours-to-ms"
533
+ ]
534
+ },
535
+ {
536
+ "slug": "is-max-future-date",
537
+ "name": "isMaxFutureDate",
538
+ "kind": "function",
539
+ "category": "date",
540
+ "module": "@dereekb/date",
541
+ "subpath": "date/date",
542
+ "signature": "isMaxFutureDate(date: Date): boolean",
543
+ "description": "Checks whether the given date matches the {@link MAX_FUTURE_DATE} sentinel.",
544
+ "params": [
545
+ {
546
+ "name": "date",
547
+ "type": "Date",
548
+ "description": "- date to check",
549
+ "optional": false
550
+ }
551
+ ],
552
+ "returns": "whether the date is the max future sentinel",
553
+ "tags": [
554
+ "date",
555
+ "sentinel",
556
+ "max",
557
+ "future",
558
+ "expiration",
559
+ "check",
560
+ "is",
561
+ "ismaxfuturedate"
562
+ ],
563
+ "example": "isMaxFutureDate(MAX_FUTURE_DATE); // true\nisMaxFutureDate(new Date()); // false",
564
+ "relatedSlugs": [
565
+ "max-future-date"
566
+ ]
567
+ },
568
+ {
569
+ "slug": "latest-minute",
570
+ "name": "latestMinute",
571
+ "kind": "function",
572
+ "category": "date",
573
+ "module": "@dereekb/date",
574
+ "subpath": "date/date",
575
+ "signature": "latestMinute(time?: Date): Date",
576
+ "description": "Returns the start of the current minute for the given time, effectively truncating seconds and milliseconds.\n\nDefaults to the current time if no input is provided.",
577
+ "params": [
578
+ {
579
+ "name": "time",
580
+ "type": "Date",
581
+ "description": "- date to truncate (defaults to now)",
582
+ "optional": true
583
+ }
584
+ ],
585
+ "returns": "date rounded down to the start of the minute",
586
+ "tags": [
587
+ "date",
588
+ "minute",
589
+ "truncate",
590
+ "floor",
591
+ "time",
592
+ "start",
593
+ "latest",
594
+ "latestminute"
595
+ ],
596
+ "example": "const date = new Date('2024-01-01T12:30:45.123Z');\nconst result = latestMinute(date);\n// result === 2024-01-01T12:30:00.000Z"
597
+ },
598
+ {
599
+ "slug": "to-iso-date-string",
600
+ "name": "toISODateString",
601
+ "kind": "function",
602
+ "category": "date",
603
+ "module": "@dereekb/date",
604
+ "subpath": "date/date",
605
+ "signature": "toISODateString(input: DateOrDateString): ISO8601DateString",
606
+ "description": "Converts the input to an ISO 8601 date string.",
607
+ "params": [
608
+ {
609
+ "name": "input",
610
+ "type": "DateOrDateString",
611
+ "description": "- date or date string to convert",
612
+ "optional": false
613
+ }
614
+ ],
615
+ "returns": "the ISO 8601 string representation",
616
+ "tags": [
617
+ "date",
618
+ "iso",
619
+ "string",
620
+ "format",
621
+ "convert",
622
+ "serialize",
623
+ "to",
624
+ "toisodatestring"
625
+ ],
626
+ "example": "toISODateString(new Date('2024-01-01T00:00:00.000Z'));\n// '2024-01-01T00:00:00.000Z'",
627
+ "relatedSlugs": [
628
+ "to-js-date",
629
+ "parse-js-date-string",
630
+ "safe-to-js-date"
631
+ ]
632
+ },
633
+ {
634
+ "slug": "guess-current-timezone",
635
+ "name": "guessCurrentTimezone",
636
+ "kind": "function",
637
+ "category": "date",
638
+ "module": "@dereekb/date",
639
+ "subpath": "date/date",
640
+ "signature": "guessCurrentTimezone(): TimezoneString | undefined",
641
+ "description": "Guesses the current system's timezone using the Intl API.",
642
+ "params": [],
643
+ "returns": "the IANA timezone string (e.g. \"America/Chicago\"), or undefined if detection fails",
644
+ "tags": [
645
+ "date",
646
+ "timezone",
647
+ "tz",
648
+ "guess",
649
+ "current",
650
+ "intl",
651
+ "system",
652
+ "guesscurrenttimezone"
653
+ ],
654
+ "example": "const tz = guessCurrentTimezone();\n// tz === 'America/New_York' (or similar)",
655
+ "relatedSlugs": [
656
+ "require-current-timezone"
657
+ ]
658
+ },
659
+ {
660
+ "slug": "require-current-timezone",
661
+ "name": "requireCurrentTimezone",
662
+ "kind": "function",
663
+ "category": "date",
664
+ "module": "@dereekb/date",
665
+ "subpath": "date/date",
666
+ "signature": "requireCurrentTimezone(): TimezoneString",
667
+ "description": "Returns the current system's timezone, throwing if detection fails.\n\nConvenience wrapper around {@link guessCurrentTimezone} for contexts where a timezone is required.",
668
+ "params": [],
669
+ "returns": "the IANA timezone string",
670
+ "tags": [
671
+ "date",
672
+ "timezone",
673
+ "tz",
674
+ "require",
675
+ "current",
676
+ "intl",
677
+ "throw",
678
+ "requirecurrenttimezone"
679
+ ],
680
+ "example": "const tz = requireCurrentTimezone();\n// tz === 'America/New_York' (guaranteed non-undefined)",
681
+ "relatedSlugs": [
682
+ "guess-current-timezone"
683
+ ]
684
+ },
685
+ {
686
+ "slug": "safe-to-js-date",
687
+ "name": "safeToJsDate",
688
+ "kind": "function",
689
+ "category": "date",
690
+ "module": "@dereekb/date",
691
+ "subpath": "date/date",
692
+ "signature": "safeToJsDate(input: Maybe<DateOrDateString | UTCDateString>): Maybe<Date>",
693
+ "description": "Null-safe variant of {@link toJsDate} that returns undefined for null/undefined input.",
694
+ "params": [
695
+ {
696
+ "name": "input",
697
+ "type": "Maybe<DateOrDateString | UTCDateString>",
698
+ "description": "- date, date string, or null/undefined",
699
+ "optional": false
700
+ }
701
+ ],
702
+ "returns": "the parsed Date or undefined if input was nullish",
703
+ "tags": [
704
+ "date",
705
+ "parse",
706
+ "convert",
707
+ "safe",
708
+ "maybe",
709
+ "nullish",
710
+ "to",
711
+ "js",
712
+ "safetojsdate"
713
+ ],
714
+ "example": "safeToJsDate('2024-01-01T00:00:00.000Z'); // Date instance\nsafeToJsDate(undefined); // undefined",
715
+ "relatedSlugs": [
716
+ "to-js-date",
717
+ "parse-js-date-string"
718
+ ]
719
+ },
720
+ {
721
+ "slug": "to-js-date",
722
+ "name": "toJsDate",
723
+ "kind": "function",
724
+ "category": "date",
725
+ "module": "@dereekb/date",
726
+ "subpath": "date/date",
727
+ "signature": "toJsDate(input: DateOrDateString | UTCDateString | UnixDateTimeMillisecondsNumber): Date",
728
+ "description": "Converts the input to a JavaScript Date instance. Accepts Date objects, ISO 8601 strings, UTC date strings, and unix millisecond timestamps.",
729
+ "params": [
730
+ {
731
+ "name": "input",
732
+ "type": "DateOrDateString | UTCDateString | UnixDateTimeMillisecondsNumber",
733
+ "description": "- value to convert",
734
+ "optional": false
735
+ }
736
+ ],
737
+ "returns": "the parsed Date",
738
+ "tags": [
739
+ "date",
740
+ "parse",
741
+ "convert",
742
+ "iso",
743
+ "unix",
744
+ "milliseconds",
745
+ "string",
746
+ "to",
747
+ "js",
748
+ "tojsdate"
749
+ ],
750
+ "example": "toJsDate('2024-01-01T00:00:00.000Z'); // Date instance\ntoJsDate(new Date()); // same Date returned\ntoJsDate(1704067200000); // Date from unix ms",
751
+ "relatedSlugs": [
752
+ "safe-to-js-date",
753
+ "parse-js-date-string",
754
+ "to-iso-date-string"
755
+ ]
756
+ },
757
+ {
758
+ "slug": "parse-js-date-string",
759
+ "name": "parseJsDateString",
760
+ "kind": "function",
761
+ "category": "date",
762
+ "module": "@dereekb/date",
763
+ "subpath": "date/date",
764
+ "signature": "parseJsDateString(input: ISO8601DateString | UTCDateString | UnixDateTimeMillisecondsNumber): Maybe<Date>",
765
+ "description": "Parses a date string or unix milliseconds timestamp into a Date, returning undefined if the result is invalid.\n\nPrefers `parseISO` for ISO 8601 strings to avoid browser inconsistencies with `new Date()`.",
766
+ "params": [
767
+ {
768
+ "name": "input",
769
+ "type": "ISO8601DateString | UTCDateString | UnixDateTimeMillisecondsNumber",
770
+ "description": "- ISO 8601 string, UTC date string, or unix milliseconds",
771
+ "optional": false
772
+ }
773
+ ],
774
+ "returns": "the parsed Date, or undefined if invalid",
775
+ "tags": [
776
+ "date",
777
+ "parse",
778
+ "string",
779
+ "iso",
780
+ "unix",
781
+ "validate",
782
+ "js",
783
+ "parsejsdatestring"
784
+ ],
785
+ "example": "parseJsDateString('2020-04-30T00:00:00.000'); // Date instance\nparseJsDateString('Sat, 03 Feb 2001 04:05:06 GMT'); // Date instance\nparseJsDateString('not-a-date'); // undefined",
786
+ "relatedSlugs": [
787
+ "to-js-date",
788
+ "safe-to-js-date"
789
+ ]
790
+ },
791
+ {
792
+ "slug": "round-down-to-minute",
793
+ "name": "roundDownToMinute",
794
+ "kind": "function",
795
+ "category": "date",
796
+ "module": "@dereekb/date",
797
+ "subpath": "date/date",
798
+ "signature": "roundDownToMinute(date?: Date): Date",
799
+ "description": "Truncates seconds and milliseconds from the input date, effectively rounding down to the start of the minute.",
800
+ "params": [
801
+ {
802
+ "name": "date",
803
+ "type": "Date",
804
+ "description": "- date to round (defaults to now)",
805
+ "optional": true
806
+ }
807
+ ],
808
+ "returns": "the date with seconds and milliseconds set to zero",
809
+ "tags": [
810
+ "date",
811
+ "round",
812
+ "floor",
813
+ "minute",
814
+ "truncate",
815
+ "time",
816
+ "down",
817
+ "to",
818
+ "rounddowntominute"
819
+ ],
820
+ "example": "const date = new Date('2024-01-01T12:30:45.123Z');\nroundDownToMinute(date); // 2024-01-01T12:30:00.000Z",
821
+ "relatedSlugs": [
822
+ "round-down-to-hour",
823
+ "round-date-down-to",
824
+ "round-date-to"
825
+ ]
826
+ },
827
+ {
828
+ "slug": "round-down-to-hour",
829
+ "name": "roundDownToHour",
830
+ "kind": "function",
831
+ "category": "date",
832
+ "module": "@dereekb/date",
833
+ "subpath": "date/date",
834
+ "signature": "roundDownToHour(date?: Date): Date",
835
+ "description": "Truncates minutes, seconds, and milliseconds from the input date, effectively rounding down to the start of the hour.",
836
+ "params": [
837
+ {
838
+ "name": "date",
839
+ "type": "Date",
840
+ "description": "- date to round (defaults to now)",
841
+ "optional": true
842
+ }
843
+ ],
844
+ "returns": "the date with minutes, seconds, and milliseconds set to zero",
845
+ "tags": [
846
+ "date",
847
+ "round",
848
+ "floor",
849
+ "hour",
850
+ "truncate",
851
+ "time",
852
+ "down",
853
+ "to",
854
+ "rounddowntohour"
855
+ ],
856
+ "example": "const date = new Date('2024-01-01T12:30:45.123Z');\nroundDownToHour(date); // 2024-01-01T12:00:00.000Z",
857
+ "relatedSlugs": [
858
+ "round-down-to-minute",
859
+ "round-date-down-to",
860
+ "round-date-to"
861
+ ]
862
+ }
863
+ ]
864
+ }