You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 16215ce
Browse filesBrowse the repository at this point in the historyBrowse files
jsdoc: ["Units to omit while calculating the duration."],
26
+
},
27
+
]
4
28
5
29
const fns:Record<
6
30
string,
@@ -12,6 +36,27 @@ const fns: Record<
12
36
tip?:string
13
37
}
14
38
> = {
39
+
diff: {
40
+
description:
41
+
"Returns the difference between two dates as a duration object. The result can be passed to <code>add</code> or formatted with <code>Intl.DurationFormat</code>.",
42
+
return: "Duration",
43
+
arguments: [
44
+
{
45
+
name: "dateA",
46
+
type: "string | Date | null",
47
+
},
48
+
{
49
+
name: "dateB",
50
+
type: "string | Date",
51
+
},
52
+
{
53
+
name: "options",
54
+
type: "DiffOptions",
55
+
comment: "abs, skip",
56
+
},
57
+
],
58
+
example: "diff",
59
+
},
15
60
diffMilliseconds: {
16
61
description:
17
62
"Returns the number of milliseconds difference between two date objects.",
{ name: "years?", type: "number", jsdoc: ["Years to add."] },
7
+
{ name: "months?", type: "number", jsdoc: ["Months to add."] },
8
+
{ name: "weeks?", type: "number", jsdoc: ["Weeks to add."] },
9
+
{ name: "days?", type: "number", jsdoc: ["Days to add."] },
10
+
{ name: "hours?", type: "number", jsdoc: ["Hours to add."] },
11
+
{ name: "minutes?", type: "number", jsdoc: ["Minutes to add."] },
12
+
{ name: "seconds?", type: "number", jsdoc: ["Seconds to add."] },
13
+
{ name: "milliseconds?", type: "number", jsdoc: ["Milliseconds to add."] },
14
+
]
4
15
5
16
const fns:Record<
6
17
string,
@@ -13,6 +24,28 @@ const fns: Record<
13
24
tip?:string
14
25
}
15
26
> = {
27
+
add: {
28
+
name: "add",
29
+
description:
30
+
"Returns a new Date object with a duration object applied. To subtract time, use negative values. Month and year overflow behavior matches <code>addMonth</code> and <code>addYear</code>.",
31
+
return: "Date",
32
+
arguments: [
33
+
{
34
+
name: "date",
35
+
type: "string | Date | null",
36
+
},
37
+
{
38
+
name: "duration",
39
+
type: "Duration",
40
+
},
41
+
{
42
+
name: "dateOverflow",
43
+
type: "boolean",
44
+
comment: "default: false",
45
+
},
46
+
],
47
+
example: "add",
48
+
},
16
49
addDay: {
17
50
name: "add-day",
18
51
description:
@@ -282,6 +315,138 @@ const fns: Record<
282
315
},
283
316
],
284
317
},
318
+
setDayOfMonth: {
319
+
name: "set-day-of-month",
320
+
description:
321
+
"Returns a new Date object with the day of the month set. By default, days beyond the end of the month clamp to the last day; set <code>dateOverflow</code> to <code>true</code> to allow overflow.",
322
+
return: "Date",
323
+
arguments: [
324
+
{
325
+
name: "date",
326
+
type: "string | Date | null",
327
+
},
328
+
{
329
+
name: "day",
330
+
type: "number",
331
+
},
332
+
{
333
+
name: "dateOverflow",
334
+
type: "boolean",
335
+
comment: "default: false",
336
+
},
337
+
],
338
+
},
339
+
setHour: {
340
+
name: "set-hour",
341
+
description:
342
+
"Returns a new Date object with the hour set. Values outside 0-23 use the native Date overflow behavior.",
343
+
return: "Date",
344
+
arguments: [
345
+
{
346
+
name: "date",
347
+
type: "string | Date | null",
348
+
},
349
+
{
350
+
name: "hour",
351
+
type: "number",
352
+
comment: "0-23",
353
+
},
354
+
],
355
+
},
356
+
setMilliseconds: {
357
+
name: "set-milliseconds",
358
+
description:
359
+
"Returns a new Date object with the millisecond value set. Values outside 0-999 use the native Date overflow behavior.",
360
+
return: "Date",
361
+
arguments: [
362
+
{
363
+
name: "date",
364
+
type: "string | Date | null",
365
+
},
366
+
{
367
+
name: "milliseconds",
368
+
type: "number",
369
+
comment: "0-999",
370
+
},
371
+
],
372
+
},
373
+
setMinutes: {
374
+
name: "set-minutes",
375
+
description:
376
+
"Returns a new Date object with the minute set. Values outside 0-59 use the native Date overflow behavior.",
377
+
return: "Date",
378
+
arguments: [
379
+
{
380
+
name: "date",
381
+
type: "string | Date | null",
382
+
},
383
+
{
384
+
name: "minute",
385
+
type: "number",
386
+
comment: "0-59",
387
+
},
388
+
],
389
+
},
390
+
setMonth: {
391
+
name: "set-month",
392
+
description:
393
+
"Returns a new Date object with the zero-based month set. By default, invalid days clamp to the last day of the target month; set <code>dateOverflow</code> to <code>true</code> to allow overflow.",
394
+
return: "Date",
395
+
arguments: [
396
+
{
397
+
name: "date",
398
+
type: "string | Date | null",
399
+
},
400
+
{
401
+
name: "month",
402
+
type: "number",
403
+
comment: "0-11, 0 is January",
404
+
},
405
+
{
406
+
name: "dateOverflow",
407
+
type: "boolean",
408
+
comment: "default: false",
409
+
},
410
+
],
411
+
},
412
+
setSeconds: {
413
+
name: "set-seconds",
414
+
description:
415
+
"Returns a new Date object with the second set. Values outside 0-59 use the native Date overflow behavior.",
416
+
return: "Date",
417
+
arguments: [
418
+
{
419
+
name: "date",
420
+
type: "string | Date | null",
421
+
},
422
+
{
423
+
name: "second",
424
+
type: "number",
425
+
comment: "0-59",
426
+
},
427
+
],
428
+
},
429
+
setYear: {
430
+
name: "set-year",
431
+
description:
432
+
"Returns a new Date object with the year set. By default, invalid leap days clamp to the last day of the target month; set <code>dateOverflow</code> to <code>true</code> to allow overflow.",
433
+
return: "Date",
434
+
arguments: [
435
+
{
436
+
name: "date",
437
+
type: "string | Date | null",
438
+
},
439
+
{
440
+
name: "year",
441
+
type: "number",
442
+
},
443
+
{
444
+
name: "dateOverflow",
445
+
type: "boolean",
446
+
comment: "default: false",
447
+
},
448
+
],
449
+
},
285
450
tzDate: {
286
451
name: "tz-date",
287
452
description: `Converts an ISO 8601 like string into a Date object with a timezone applied. For example, <code>tzDate('2021-01-01T00:00', 'America/Los_Angeles')</code> will return a Date object representing 2021-01-01 00:00 in L.A.`,
0 commit comments