@formkit/tempo 0.1.2 → 1.1.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.
- package/README.md +22 -1
- package/dist/add.d.ts +11 -0
- package/dist/add.mjs +50 -0
- package/dist/add.mjs.map +1 -0
- package/dist/addDay.d.ts +4 -3
- package/dist/addDay.mjs.map +1 -1
- package/dist/addHour.d.ts +4 -3
- package/dist/addHour.mjs.map +1 -1
- package/dist/addMillisecond.d.ts +10 -0
- package/dist/addMillisecond.mjs +11 -0
- package/dist/addMillisecond.mjs.map +1 -0
- package/dist/addMinute.d.ts +5 -4
- package/dist/addMinute.mjs.map +1 -1
- package/dist/addMonth.d.ts +5 -5
- package/dist/addMonth.mjs +2 -12
- package/dist/addMonth.mjs.map +1 -1
- package/dist/addSecond.d.ts +4 -3
- package/dist/addSecond.mjs.map +1 -1
- package/dist/addYear.d.ts +5 -5
- package/dist/addYear.mjs +6 -12
- package/dist/addYear.mjs.map +1 -1
- package/dist/ap.mjs +1 -2
- package/dist/ap.mjs.map +1 -1
- package/dist/applyOffset.d.ts +5 -5
- package/dist/applyOffset.mjs +5 -11
- package/dist/applyOffset.mjs.map +1 -1
- package/dist/bundle.d.ts +365 -115
- package/dist/bundle.mjs +364 -180
- package/dist/bundle.mjs.map +1 -1
- package/dist/common.d.ts +27 -7
- package/dist/common.mjs +47 -42
- package/dist/common.mjs.map +1 -1
- package/dist/date.d.ts +2 -2
- package/dist/date.mjs +1 -3
- package/dist/date.mjs.map +1 -1
- package/dist/dayEnd.d.ts +3 -3
- package/dist/dayEnd.mjs.map +1 -1
- package/dist/dayOfYear.d.ts +3 -3
- package/dist/dayOfYear.mjs.map +1 -1
- package/dist/dayStart.d.ts +3 -3
- package/dist/dayStart.mjs +1 -1
- package/dist/dayStart.mjs.map +1 -1
- package/dist/diff.d.ts +38 -0
- package/dist/diff.mjs +86 -0
- package/dist/diff.mjs.map +1 -0
- package/dist/diffDays.d.ts +12 -5
- package/dist/diffDays.mjs +1 -0
- package/dist/diffDays.mjs.map +1 -1
- package/dist/diffHours.d.ts +12 -5
- package/dist/diffHours.mjs +1 -0
- package/dist/diffHours.mjs.map +1 -1
- package/dist/diffMilliseconds.d.ts +10 -4
- package/dist/diffMilliseconds.mjs.map +1 -1
- package/dist/diffMinutes.d.ts +11 -3
- package/dist/diffMinutes.mjs +5 -1
- package/dist/diffMinutes.mjs.map +1 -1
- package/dist/diffMonths.d.ts +10 -4
- package/dist/diffMonths.mjs.map +1 -1
- package/dist/diffSeconds.d.ts +12 -5
- package/dist/diffSeconds.mjs +5 -1
- package/dist/diffSeconds.mjs.map +1 -1
- package/dist/diffWeeks.d.ts +10 -3
- package/dist/diffWeeks.mjs.map +1 -1
- package/dist/diffYears.d.ts +10 -4
- package/dist/diffYears.mjs +4 -1
- package/dist/diffYears.mjs.map +1 -1
- package/dist/format.mjs +2 -3
- package/dist/format.mjs.map +1 -1
- package/dist/handleDateOverflow.d.ts +12 -0
- package/dist/handleDateOverflow.mjs +18 -0
- package/dist/handleDateOverflow.mjs.map +1 -0
- package/dist/hourEnd.d.ts +3 -3
- package/dist/hourEnd.mjs.map +1 -1
- package/dist/hourStart.d.ts +3 -3
- package/dist/hourStart.mjs +1 -1
- package/dist/hourStart.mjs.map +1 -1
- package/dist/index.cjs +380 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +365 -115
- package/dist/index.d.ts +14 -1
- package/dist/index.mjs +26 -0
- package/dist/index.mjs.map +1 -1
- package/dist/isAfter.d.ts +6 -6
- package/dist/isAfter.mjs.map +1 -1
- package/dist/isBefore.d.ts +5 -5
- package/dist/isBefore.mjs.map +1 -1
- package/dist/isEqual.d.ts +13 -4
- package/dist/isEqual.mjs.map +1 -1
- package/dist/isFuture.d.ts +10 -0
- package/dist/isFuture.mjs +9 -0
- package/dist/isFuture.mjs.map +1 -0
- package/dist/isPast.d.ts +10 -0
- package/dist/isPast.mjs +9 -0
- package/dist/isPast.mjs.map +1 -0
- package/dist/iso8601.d.ts +1 -1
- package/dist/iso8601.mjs +4 -7
- package/dist/iso8601.mjs.map +1 -1
- package/dist/minuteEnd.d.ts +3 -3
- package/dist/minuteEnd.mjs.map +1 -1
- package/dist/minuteStart.d.ts +3 -3
- package/dist/minuteStart.mjs +1 -1
- package/dist/minuteStart.mjs.map +1 -1
- package/dist/monthDays.d.ts +3 -3
- package/dist/monthDays.mjs.map +1 -1
- package/dist/monthEnd.d.ts +3 -3
- package/dist/monthEnd.mjs.map +1 -1
- package/dist/monthStart.d.ts +3 -3
- package/dist/monthStart.mjs +1 -1
- package/dist/monthStart.mjs.map +1 -1
- package/dist/nearestDay.d.ts +3 -3
- package/dist/nearestDay.mjs +2 -4
- package/dist/nearestDay.mjs.map +1 -1
- package/dist/offset.d.ts +5 -5
- package/dist/offset.mjs +16 -16
- package/dist/offset.mjs.map +1 -1
- package/dist/parse.mjs +33 -23
- package/dist/parse.mjs.map +1 -1
- package/dist/parts.mjs +14 -24
- package/dist/parts.mjs.map +1 -1
- package/dist/range.mjs +1 -2
- package/dist/range.mjs.map +1 -1
- package/dist/removeOffset.d.ts +4 -4
- package/dist/removeOffset.mjs.map +1 -1
- package/dist/sameDay.d.ts +8 -2
- package/dist/sameDay.mjs.map +1 -1
- package/dist/sameHour.d.ts +8 -2
- package/dist/sameHour.mjs.map +1 -1
- package/dist/sameMillisecond.d.ts +16 -0
- package/dist/sameMillisecond.mjs +11 -0
- package/dist/sameMillisecond.mjs.map +1 -0
- package/dist/sameMinute.d.ts +8 -2
- package/dist/sameMinute.mjs.map +1 -1
- package/dist/sameMonth.d.ts +16 -0
- package/dist/sameMonth.mjs +11 -0
- package/dist/sameMonth.mjs.map +1 -0
- package/dist/sameSecond.d.ts +8 -2
- package/dist/sameSecond.mjs.map +1 -1
- package/dist/sameYear.d.ts +8 -2
- package/dist/sameYear.mjs.map +1 -1
- package/dist/setDayOfMonth.d.ts +11 -0
- package/dist/setDayOfMonth.mjs +16 -0
- package/dist/setDayOfMonth.mjs.map +1 -0
- package/dist/setHour.d.ts +10 -0
- package/dist/setHour.mjs +11 -0
- package/dist/setHour.mjs.map +1 -0
- package/dist/setMilliseconds.d.ts +10 -0
- package/dist/setMilliseconds.mjs +11 -0
- package/dist/setMilliseconds.mjs.map +1 -0
- package/dist/setMinutes.d.ts +10 -0
- package/dist/setMinutes.mjs +11 -0
- package/dist/setMinutes.mjs.map +1 -0
- package/dist/setMonth.d.ts +11 -0
- package/dist/setMonth.mjs +9 -0
- package/dist/setMonth.mjs.map +1 -0
- package/dist/setSeconds.d.ts +10 -0
- package/dist/setSeconds.mjs +11 -0
- package/dist/setSeconds.mjs.map +1 -0
- package/dist/setYear.d.ts +11 -0
- package/dist/setYear.mjs +9 -0
- package/dist/setYear.mjs.map +1 -0
- package/dist/types.d.ts +29 -7
- package/dist/tzDate.d.ts +5 -3
- package/dist/tzDate.mjs.map +1 -1
- package/dist/weekEnd.d.ts +4 -4
- package/dist/weekEnd.mjs +1 -1
- package/dist/weekEnd.mjs.map +1 -1
- package/dist/weekStart.d.ts +4 -4
- package/dist/weekStart.mjs +2 -3
- package/dist/weekStart.mjs.map +1 -1
- package/dist/yearDays.d.ts +3 -3
- package/dist/yearDays.mjs.map +1 -1
- package/dist/yearEnd.d.ts +3 -3
- package/dist/yearEnd.mjs +1 -2
- package/dist/yearEnd.mjs.map +1 -1
- package/dist/yearStart.d.ts +3 -3
- package/dist/yearStart.mjs +2 -3
- package/dist/yearStart.mjs.map +1 -1
- package/package.json +32 -23
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export { add } from './add.js';
|
|
1
2
|
export { addDay } from './addDay.js';
|
|
2
3
|
export { addMonth } from './addMonth.js';
|
|
3
4
|
export { addYear } from './addYear.js';
|
|
4
5
|
export { addHour } from './addHour.js';
|
|
5
6
|
export { addMinute } from './addMinute.js';
|
|
6
7
|
export { addSecond } from './addSecond.js';
|
|
8
|
+
export { addMillisecond } from './addMillisecond.js';
|
|
7
9
|
export { ap } from './ap.js';
|
|
8
10
|
export { applyOffset } from './applyOffset.js';
|
|
9
11
|
export { date } from './date.js';
|
|
@@ -30,9 +32,17 @@ export { range } from './range.js';
|
|
|
30
32
|
export { removeOffset } from './removeOffset.js';
|
|
31
33
|
export { sameDay } from './sameDay.js';
|
|
32
34
|
export { sameSecond } from './sameSecond.js';
|
|
35
|
+
export { sameMillisecond } from './sameMillisecond.js';
|
|
33
36
|
export { sameMinute } from './sameMinute.js';
|
|
34
37
|
export { sameHour } from './sameHour.js';
|
|
35
38
|
export { sameYear } from './sameYear.js';
|
|
39
|
+
export { setMilliseconds } from './setMilliseconds.js';
|
|
40
|
+
export { setSeconds } from './setSeconds.js';
|
|
41
|
+
export { setMinutes } from './setMinutes.js';
|
|
42
|
+
export { setHour } from './setHour.js';
|
|
43
|
+
export { setDayOfMonth } from './setDayOfMonth.js';
|
|
44
|
+
export { setMonth } from './setMonth.js';
|
|
45
|
+
export { setYear } from './setYear.js';
|
|
36
46
|
export { weekEnd } from './weekEnd.js';
|
|
37
47
|
export { weekStart } from './weekStart.js';
|
|
38
48
|
export { yearDays } from './yearDays.js';
|
|
@@ -41,7 +51,9 @@ export { yearEnd } from './yearEnd.js';
|
|
|
41
51
|
export { isBefore } from './isBefore.js';
|
|
42
52
|
export { isAfter } from './isAfter.js';
|
|
43
53
|
export { isEqual } from './isEqual.js';
|
|
44
|
-
export {
|
|
54
|
+
export { isPast } from './isPast.js';
|
|
55
|
+
export { isFuture } from './isFuture.js';
|
|
56
|
+
export { DateInput, Duration, DurationObj, ExtendedPartTypes, FilledPart, Format, FormatOptions, FormatPattern, FormatStyle, FormatStyleObj, FormatToken, MaybeDateInput, NamedFormatOption, NamedFormats, ParseOptions, Part } from './types.js';
|
|
45
57
|
export { diffMilliseconds } from './diffMilliseconds.js';
|
|
46
58
|
export { diffSeconds } from './diffSeconds.js';
|
|
47
59
|
export { diffMinutes } from './diffMinutes.js';
|
|
@@ -50,5 +62,6 @@ export { diffDays } from './diffDays.js';
|
|
|
50
62
|
export { diffWeeks } from './diffWeeks.js';
|
|
51
63
|
export { diffMonths } from './diffMonths.js';
|
|
52
64
|
export { diffYears } from './diffYears.js';
|
|
65
|
+
export { DiffOptions, diff } from './diff.js';
|
|
53
66
|
import './common.js';
|
|
54
67
|
import './diffRound.js';
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import { add } from "./add.mjs";
|
|
2
3
|
import { addDay } from "./addDay.mjs";
|
|
3
4
|
import { addMonth } from "./addMonth.mjs";
|
|
4
5
|
import { addYear } from "./addYear.mjs";
|
|
5
6
|
import { addHour } from "./addHour.mjs";
|
|
6
7
|
import { addMinute } from "./addMinute.mjs";
|
|
7
8
|
import { addSecond } from "./addSecond.mjs";
|
|
9
|
+
import { addMillisecond } from "./addMillisecond.mjs";
|
|
8
10
|
import { ap } from "./ap.mjs";
|
|
9
11
|
import { applyOffset } from "./applyOffset.mjs";
|
|
10
12
|
import { date } from "./date.mjs";
|
|
@@ -32,9 +34,17 @@ import { range } from "./range.mjs";
|
|
|
32
34
|
import { removeOffset } from "./removeOffset.mjs";
|
|
33
35
|
import { sameDay } from "./sameDay.mjs";
|
|
34
36
|
import { sameSecond } from "./sameSecond.mjs";
|
|
37
|
+
import { sameMillisecond } from "./sameMillisecond.mjs";
|
|
35
38
|
import { sameMinute } from "./sameMinute.mjs";
|
|
36
39
|
import { sameHour } from "./sameHour.mjs";
|
|
37
40
|
import { sameYear } from "./sameYear.mjs";
|
|
41
|
+
import { setMilliseconds } from "./setMilliseconds.mjs";
|
|
42
|
+
import { setSeconds } from "./setSeconds.mjs";
|
|
43
|
+
import { setMinutes } from "./setMinutes.mjs";
|
|
44
|
+
import { setHour } from "./setHour.mjs";
|
|
45
|
+
import { setDayOfMonth } from "./setDayOfMonth.mjs";
|
|
46
|
+
import { setMonth } from "./setMonth.mjs";
|
|
47
|
+
import { setYear } from "./setYear.mjs";
|
|
38
48
|
import { weekEnd } from "./weekEnd.mjs";
|
|
39
49
|
import { weekStart } from "./weekStart.mjs";
|
|
40
50
|
import { yearDays } from "./yearDays.mjs";
|
|
@@ -43,6 +53,8 @@ import { yearEnd } from "./yearEnd.mjs";
|
|
|
43
53
|
import { isBefore } from "./isBefore.mjs";
|
|
44
54
|
import { isAfter } from "./isAfter.mjs";
|
|
45
55
|
import { isEqual } from "./isEqual.mjs";
|
|
56
|
+
import { isPast } from "./isPast.mjs";
|
|
57
|
+
import { isFuture } from "./isFuture.mjs";
|
|
46
58
|
export * from "./types.mjs";
|
|
47
59
|
import { diffMilliseconds } from "./diffMilliseconds.mjs";
|
|
48
60
|
import { diffSeconds } from "./diffSeconds.mjs";
|
|
@@ -52,9 +64,12 @@ import { diffDays } from "./diffDays.mjs";
|
|
|
52
64
|
import { diffWeeks } from "./diffWeeks.mjs";
|
|
53
65
|
import { diffMonths } from "./diffMonths.mjs";
|
|
54
66
|
import { diffYears } from "./diffYears.mjs";
|
|
67
|
+
import { diff } from "./diff.mjs";
|
|
55
68
|
export {
|
|
69
|
+
add,
|
|
56
70
|
addDay,
|
|
57
71
|
addHour,
|
|
72
|
+
addMillisecond,
|
|
58
73
|
addMinute,
|
|
59
74
|
addMonth,
|
|
60
75
|
addSecond,
|
|
@@ -65,6 +80,7 @@ export {
|
|
|
65
80
|
dayEnd,
|
|
66
81
|
dayOfYear,
|
|
67
82
|
dayStart,
|
|
83
|
+
diff,
|
|
68
84
|
diffDays,
|
|
69
85
|
diffHours,
|
|
70
86
|
diffMilliseconds,
|
|
@@ -81,6 +97,8 @@ export {
|
|
|
81
97
|
isAfter,
|
|
82
98
|
isBefore,
|
|
83
99
|
isEqual,
|
|
100
|
+
isFuture,
|
|
101
|
+
isPast,
|
|
84
102
|
iso8601,
|
|
85
103
|
minuteEnd,
|
|
86
104
|
minuteStart,
|
|
@@ -96,9 +114,17 @@ export {
|
|
|
96
114
|
removeOffset,
|
|
97
115
|
sameDay,
|
|
98
116
|
sameHour,
|
|
117
|
+
sameMillisecond,
|
|
99
118
|
sameMinute,
|
|
100
119
|
sameSecond,
|
|
101
120
|
sameYear,
|
|
121
|
+
setDayOfMonth,
|
|
122
|
+
setHour,
|
|
123
|
+
setMilliseconds,
|
|
124
|
+
setMinutes,
|
|
125
|
+
setMonth,
|
|
126
|
+
setSeconds,
|
|
127
|
+
setYear,
|
|
102
128
|
tzDate,
|
|
103
129
|
weekEnd,
|
|
104
130
|
weekStart,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { addDay } from \"./addDay\"\nexport { addMonth } from \"./addMonth\"\nexport { addYear } from \"./addYear\"\nexport { addHour } from \"./addHour\"\nexport { addMinute } from \"./addMinute\"\nexport { addSecond } from \"./addSecond\"\nexport { ap } from \"./ap\"\nexport { applyOffset } from \"./applyOffset\"\nexport { date } from \"./date\"\nexport { tzDate } from \"./tzDate\"\nexport { dayOfYear } from \"./dayOfYear\"\nexport { dayEnd } from \"./dayEnd\"\nexport { dayStart } from \"./dayStart\"\nexport { format } from \"./format\"\nexport { formatStr } from \"./formatStr\"\nexport { fourDigitYear } from \"./fourDigitYear\"\nexport { hourEnd } from \"./hourEnd\"\nexport { hourStart } from \"./hourStart\"\nexport { iso8601 } from \"./iso8601\"\nexport { minuteEnd } from \"./minuteEnd\"\nexport { minuteStart } from \"./minuteStart\"\nexport { monthDays } from \"./monthDays\"\nexport { monthEnd } from \"./monthEnd\"\nexport { monthStart } from \"./monthStart\"\nexport { nearestDay } from \"./nearestDay\"\nexport { offset } from \"./offset\"\nexport { parse } from \"./parse\"\nexport { parseParts } from \"./parse\"\nexport { parts } from \"./parts\"\nexport { range } from \"./range\"\nexport { removeOffset } from \"./removeOffset\"\nexport { sameDay } from \"./sameDay\"\nexport { sameSecond } from \"./sameSecond\"\nexport { sameMinute } from \"./sameMinute\"\nexport { sameHour } from \"./sameHour\"\nexport { sameYear } from \"./sameYear\"\nexport { weekEnd } from \"./weekEnd\"\nexport { weekStart } from \"./weekStart\"\nexport { yearDays } from \"./yearDays\"\nexport { yearStart } from \"./yearStart\"\nexport { yearEnd } from \"./yearEnd\"\nexport { isBefore } from \"./isBefore\"\nexport { isAfter } from \"./isAfter\"\nexport { isEqual } from \"./isEqual\"\nexport * from \"./types\"\nexport { diffMilliseconds } from \"./diffMilliseconds\"\nexport { diffSeconds } from \"./diffSeconds\"\nexport { diffMinutes } from \"./diffMinutes\"\nexport { diffHours } from \"./diffHours\"\nexport { diffDays } from \"./diffDays\"\nexport { diffWeeks } from \"./diffWeeks\"\nexport { diffMonths } from \"./diffMonths\"\nexport { diffYears } from \"./diffYears\"\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,cAAc;AACd,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { add } from \"./add\"\nexport { addDay } from \"./addDay\"\nexport { addMonth } from \"./addMonth\"\nexport { addYear } from \"./addYear\"\nexport { addHour } from \"./addHour\"\nexport { addMinute } from \"./addMinute\"\nexport { addSecond } from \"./addSecond\"\nexport { addMillisecond } from \"./addMillisecond\"\nexport { ap } from \"./ap\"\nexport { applyOffset } from \"./applyOffset\"\nexport { date } from \"./date\"\nexport { tzDate } from \"./tzDate\"\nexport { dayOfYear } from \"./dayOfYear\"\nexport { dayEnd } from \"./dayEnd\"\nexport { dayStart } from \"./dayStart\"\nexport { format } from \"./format\"\nexport { formatStr } from \"./formatStr\"\nexport { fourDigitYear } from \"./fourDigitYear\"\nexport { hourEnd } from \"./hourEnd\"\nexport { hourStart } from \"./hourStart\"\nexport { iso8601 } from \"./iso8601\"\nexport { minuteEnd } from \"./minuteEnd\"\nexport { minuteStart } from \"./minuteStart\"\nexport { monthDays } from \"./monthDays\"\nexport { monthEnd } from \"./monthEnd\"\nexport { monthStart } from \"./monthStart\"\nexport { nearestDay } from \"./nearestDay\"\nexport { offset } from \"./offset\"\nexport { parse } from \"./parse\"\nexport { parseParts } from \"./parse\"\nexport { parts } from \"./parts\"\nexport { range } from \"./range\"\nexport { removeOffset } from \"./removeOffset\"\nexport { sameDay } from \"./sameDay\"\nexport { sameSecond } from \"./sameSecond\"\nexport { sameMillisecond } from \"./sameMillisecond\"\nexport { sameMinute } from \"./sameMinute\"\nexport { sameHour } from \"./sameHour\"\nexport { sameYear } from \"./sameYear\"\nexport { setMilliseconds } from \"./setMilliseconds\"\nexport { setSeconds } from \"./setSeconds\"\nexport { setMinutes } from \"./setMinutes\"\nexport { setHour } from \"./setHour\"\nexport { setDayOfMonth } from \"./setDayOfMonth\"\nexport { setMonth } from \"./setMonth\"\nexport { setYear } from \"./setYear\"\nexport { weekEnd } from \"./weekEnd\"\nexport { weekStart } from \"./weekStart\"\nexport { yearDays } from \"./yearDays\"\nexport { yearStart } from \"./yearStart\"\nexport { yearEnd } from \"./yearEnd\"\nexport { isBefore } from \"./isBefore\"\nexport { isAfter } from \"./isAfter\"\nexport { isEqual } from \"./isEqual\"\nexport { isPast } from \"./isPast\"\nexport { isFuture } from \"./isFuture\"\nexport * from \"./types\"\nexport { diffMilliseconds } from \"./diffMilliseconds\"\nexport { diffSeconds } from \"./diffSeconds\"\nexport { diffMinutes } from \"./diffMinutes\"\nexport { diffHours } from \"./diffHours\"\nexport { diffDays } from \"./diffDays\"\nexport { diffWeeks } from \"./diffWeeks\"\nexport { diffMonths } from \"./diffMonths\"\nexport { diffYears } from \"./diffYears\"\nexport { diff, type DiffOptions } from \"./diff\"\n"],"mappings":";AAAA,SAAS,WAAW;AACpB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,cAAc;AACd,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,YAA8B;","names":[]}
|
package/dist/isAfter.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { DateInput } from './types.js';
|
|
1
|
+
import { DateInput, MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @name isAfter
|
|
5
5
|
* @category Common Helpers
|
|
6
|
-
* @summary Is the first date after the second one?
|
|
6
|
+
* @summary Is the first date after the second one or the current time?
|
|
7
7
|
*
|
|
8
8
|
* @description
|
|
9
|
-
* Is the first date after the second one?
|
|
9
|
+
* Is the first date after the second one or the current time?
|
|
10
10
|
*
|
|
11
11
|
* @param inputDate - The date that should be after the other one to return true
|
|
12
|
-
* @param dateToCompare - The date to compare with
|
|
12
|
+
* @param [dateToCompare] - The date to compare with or the current time if nothing given
|
|
13
13
|
*
|
|
14
|
-
* @returns The first date is after the second date.
|
|
14
|
+
* @returns The first date is after the second date or the current time.
|
|
15
15
|
*/
|
|
16
|
-
declare function isAfter(inputDate: DateInput, dateToCompare
|
|
16
|
+
declare function isAfter(inputDate: DateInput, dateToCompare?: MaybeDateInput): boolean;
|
|
17
17
|
|
|
18
18
|
export { isAfter };
|
package/dist/isAfter.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/isAfter.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput } from \"./types\"\n\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one?\n *\n * @description\n * Is the first date after the second one?\n *\n * @param inputDate - The date that should be after the other one to return true\n * @param dateToCompare - The date to compare with\n *\n * @returns The first date is after the second date.\n */\nexport function isAfter(inputDate: DateInput, dateToCompare
|
|
1
|
+
{"version":3,"sources":["../src/isAfter.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one or the current time?\n *\n * @description\n * Is the first date after the second one or the current time?\n *\n * @param inputDate - The date that should be after the other one to return true\n * @param [dateToCompare] - The date to compare with or the current time if nothing given\n *\n * @returns The first date is after the second date or the current time.\n */\nexport function isAfter(inputDate: DateInput, dateToCompare?: MaybeDateInput) {\n const _date = date(inputDate)\n const _dateToCompare = date(dateToCompare)\n\n return +_date > +_dateToCompare\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAgBd,SAAS,QAAQ,WAAsB,eAAgC;AAC5E,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,iBAAiB,KAAK,aAAa;AAEzC,SAAO,CAAC,QAAQ,CAAC;AACnB;","names":[]}
|
package/dist/isBefore.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DateInput } from './types.js';
|
|
1
|
+
import { DateInput, MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Is the first date before the second one?
|
|
4
|
+
* Is the first date before the second one or the current time?
|
|
5
5
|
*
|
|
6
6
|
* @param inputDate - The date that should be before the other one to return true
|
|
7
|
-
* @param dateToCompare - The date to compare with
|
|
7
|
+
* @param [dateToCompare] - The date to compare with or the current time if nothing given
|
|
8
8
|
*
|
|
9
|
-
* @returns The first date is before the second date.
|
|
9
|
+
* @returns The first date is before the second date or the current time.
|
|
10
10
|
*/
|
|
11
|
-
declare function isBefore(inputDate: DateInput, dateToCompare
|
|
11
|
+
declare function isBefore(inputDate: DateInput, dateToCompare?: MaybeDateInput): boolean;
|
|
12
12
|
|
|
13
13
|
export { isBefore };
|
package/dist/isBefore.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/isBefore.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput } from \"./types\"\n\n/**\n * Is the first date before the second one?\n *\n * @param inputDate - The date that should be before the other one to return true\n * @param dateToCompare - The date to compare with\n *\n * @returns The first date is before the second date.\n */\nexport function isBefore(inputDate: DateInput, dateToCompare
|
|
1
|
+
{"version":3,"sources":["../src/isBefore.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Is the first date before the second one or the current time?\n *\n * @param inputDate - The date that should be before the other one to return true\n * @param [dateToCompare] - The date to compare with or the current time if nothing given\n *\n * @returns The first date is before the second date or the current time.\n */\nexport function isBefore(inputDate: DateInput, dateToCompare?: MaybeDateInput): boolean {\n const _date = date(inputDate)\n const _dateToCompare = date(dateToCompare)\n\n return +_date < +_dateToCompare\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAWd,SAAS,SAAS,WAAsB,eAAyC;AACtF,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,iBAAiB,KAAK,aAAa;AAEzC,SAAO,CAAC,QAAQ,CAAC;AACnB;","names":[]}
|
package/dist/isEqual.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { DateInput } from './types.js';
|
|
1
|
+
import { DateInput, MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Are the given dates equal?
|
|
4
|
+
* Are the given dates equal or given date to the current time?
|
|
5
5
|
*
|
|
6
6
|
* @param dateLeft - The first date to compare
|
|
7
|
+
* @param [dateRight] - The second date to compare or the current time of nothing given
|
|
8
|
+
*
|
|
9
|
+
* @returns The dates are equal or date to the current time
|
|
10
|
+
*/
|
|
11
|
+
declare function isEqual(dateLeft: DateInput, dateRight?: MaybeDateInput): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Are the given dates equal or given date to the current time?
|
|
14
|
+
*
|
|
15
|
+
* @param [dateLeft] - The first date to compare or the current time if null given
|
|
7
16
|
* @param dateRight - The second date to compare
|
|
8
17
|
*
|
|
9
|
-
* @returns The dates are equal
|
|
18
|
+
* @returns The dates are equal or date to the current time
|
|
10
19
|
*/
|
|
11
|
-
declare function isEqual(dateLeft:
|
|
20
|
+
declare function isEqual(dateLeft: MaybeDateInput, dateRight: DateInput): boolean;
|
|
12
21
|
|
|
13
22
|
export { isEqual };
|
package/dist/isEqual.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/isEqual.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput } from \"./types\"\n\n/**\n * Are the given dates equal?\n *\n * @param dateLeft - The first date to compare\n * @param dateRight - The second date to compare\n *\n * @returns The dates are equal
|
|
1
|
+
{"version":3,"sources":["../src/isEqual.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { DateInput, MaybeDateInput } from \"./types\"\n\n/**\n * Are the given dates equal or given date to the current time?\n *\n * @param dateLeft - The first date to compare\n * @param [dateRight] - The second date to compare or the current time of nothing given\n *\n * @returns The dates are equal or date to the current time\n */\nexport function isEqual(dateLeft: DateInput, dateRight?: MaybeDateInput): boolean\n/**\n * Are the given dates equal or given date to the current time?\n *\n * @param [dateLeft] - The first date to compare or the current time if null given\n * @param dateRight - The second date to compare\n *\n * @returns The dates are equal or date to the current time\n */\n\nexport function isEqual(dateLeft: MaybeDateInput, dateRight: DateInput): boolean\nexport function isEqual(dateLeft: MaybeDateInput, dateRight?: MaybeDateInput): boolean {\n const _dateLeft = date(dateLeft)\n const _dateRight = date(dateRight)\n\n return +_dateLeft === +_dateRight\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAsBd,SAAS,QAAQ,UAA0B,WAAqC;AACrF,QAAM,YAAY,KAAK,QAAQ;AAC/B,QAAM,aAAa,KAAK,SAAS;AAEjC,SAAO,CAAC,cAAc,CAAC;AACzB;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DateInput } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* is the date in the future compared to the current time
|
|
5
|
+
* @param inputDate - The date that should be in the future
|
|
6
|
+
* @returns the given date is in the future compared to the current time
|
|
7
|
+
*/
|
|
8
|
+
declare function isFuture(inputDate: DateInput): boolean;
|
|
9
|
+
|
|
10
|
+
export { isFuture };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isFuture.ts"],"sourcesContent":["import { isAfter } from \"./isAfter\"\nimport { DateInput } from \"./types\"\n\n/**\n * is the date in the future compared to the current time\n * @param inputDate - The date that should be in the future\n * @returns the given date is in the future compared to the current time\n */\nexport function isFuture(inputDate: DateInput): boolean {\n return isAfter(inputDate)\n}\n"],"mappings":";AAAA,SAAS,eAAe;AAQjB,SAAS,SAAS,WAA+B;AACtD,SAAO,QAAQ,SAAS;AAC1B;","names":[]}
|
package/dist/isPast.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DateInput } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* is the date in the past compared to the current time
|
|
5
|
+
* @param inputDate - The date that should be in the past
|
|
6
|
+
* @returns the given date is in the past compared to the current time
|
|
7
|
+
*/
|
|
8
|
+
declare function isPast(inputDate: DateInput): boolean;
|
|
9
|
+
|
|
10
|
+
export { isPast };
|
package/dist/isPast.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/isPast.ts"],"sourcesContent":["import { isBefore } from \"./isBefore\"\nimport { DateInput } from \"./types\"\n\n/**\n * is the date in the past compared to the current time\n * @param inputDate - The date that should be in the past\n * @returns the given date is in the past compared to the current time\n */\nexport function isPast(inputDate: DateInput): boolean {\n return isBefore(inputDate)\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAQlB,SAAS,OAAO,WAA+B;AACpD,SAAO,SAAS,SAAS;AAC3B;","names":[]}
|
package/dist/iso8601.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Matches a given date with ISO 8601 compliance. Allows the "T" to be missing
|
|
3
3
|
* and only requires year and month, other params are required with increasing
|
|
4
|
-
* specificity.
|
|
4
|
+
* specificity. Supports timezone offsets with optional seconds (e.g., +05:32:11).
|
|
5
5
|
*/
|
|
6
6
|
declare const iso8601Match: RegExp;
|
|
7
7
|
/**
|
package/dist/iso8601.mjs
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
// src/iso8601.ts
|
|
2
|
-
var iso8601Match = /^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\.[0-9]+)?(Z|(?:\+|\-)[0-9]{2}:?[0-9]{2})?$/;
|
|
2
|
+
var iso8601Match = /^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\.[0-9]+)?(Z|(?:\+|\-)[0-9]{2}:?[0-9]{2}(?::?[0-9]{2})?)?$/;
|
|
3
3
|
function iso8601(date) {
|
|
4
4
|
const matches = date.match(iso8601Match);
|
|
5
5
|
if (matches) {
|
|
6
6
|
const month = Number(matches[2]);
|
|
7
|
-
if (month < 1 || month > 12)
|
|
8
|
-
return false;
|
|
7
|
+
if (month < 1 || month > 12) return false;
|
|
9
8
|
if (typeof matches[3] !== void 0) {
|
|
10
9
|
const date2 = Number(matches[3]);
|
|
11
|
-
if (date2 < 1 || date2 > 31)
|
|
12
|
-
return false;
|
|
10
|
+
if (date2 < 1 || date2 > 31) return false;
|
|
13
11
|
}
|
|
14
12
|
if (typeof matches[4] !== void 0) {
|
|
15
13
|
const hours = Number(matches[4]);
|
|
16
|
-
if (hours < 0 || hours > 23)
|
|
17
|
-
return false;
|
|
14
|
+
if (hours < 0 || hours > 23) return false;
|
|
18
15
|
}
|
|
19
16
|
return true;
|
|
20
17
|
}
|
package/dist/iso8601.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/iso8601.ts"],"sourcesContent":["/**\n * Matches a given date with ISO 8601 compliance. Allows the \"T\" to be missing\n * and only requires year and month, other params are required with increasing\n * specificity.\n */\nexport const iso8601Match =\n /^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\\.[0-9]+)?(Z|(?:\\+|\\-)[0-9]{2}:?[0-9]{2})?$/\n\n/**\n * True when the date string is valid ISO 8601.\n * @param date - A date string.\n */\nexport function iso8601(date: string): boolean {\n const matches = date.match(iso8601Match)\n if (matches) {\n const month = Number(matches[2])\n if (month < 1 || month > 12) return false\n\n if (typeof matches[3] !== undefined) {\n const date = Number(matches[3])\n if (date < 1 || date > 31) return false\n }\n if (typeof matches[4] !== undefined) {\n const hours = Number(matches[4])\n if (hours < 0 || hours > 23) return false\n }\n\n return true\n }\n return false\n}\n"],"mappings":";AAKO,IAAM,eACX;AAMK,SAAS,QAAQ,MAAuB;AAC7C,QAAM,UAAU,KAAK,MAAM,YAAY;AACvC,MAAI,SAAS;AACX,UAAM,QAAQ,OAAO,QAAQ,CAAC,CAAC;AAC/B,QAAI,QAAQ,KAAK,QAAQ
|
|
1
|
+
{"version":3,"sources":["../src/iso8601.ts"],"sourcesContent":["/**\n * Matches a given date with ISO 8601 compliance. Allows the \"T\" to be missing\n * and only requires year and month, other params are required with increasing\n * specificity. Supports timezone offsets with optional seconds (e.g., +05:32:11).\n */\nexport const iso8601Match =\n /^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\\.[0-9]+)?(Z|(?:\\+|\\-)[0-9]{2}:?[0-9]{2}(?::?[0-9]{2})?)?$/\n\n/**\n * True when the date string is valid ISO 8601.\n * @param date - A date string.\n */\nexport function iso8601(date: string): boolean {\n const matches = date.match(iso8601Match)\n if (matches) {\n const month = Number(matches[2])\n if (month < 1 || month > 12) return false\n\n if (typeof matches[3] !== undefined) {\n const date = Number(matches[3])\n if (date < 1 || date > 31) return false\n }\n if (typeof matches[4] !== undefined) {\n const hours = Number(matches[4])\n if (hours < 0 || hours > 23) return false\n }\n\n return true\n }\n return false\n}\n"],"mappings":";AAKO,IAAM,eACX;AAMK,SAAS,QAAQ,MAAuB;AAC7C,QAAM,UAAU,KAAK,MAAM,YAAY;AACvC,MAAI,SAAS;AACX,UAAM,QAAQ,OAAO,QAAQ,CAAC,CAAC;AAC/B,QAAI,QAAQ,KAAK,QAAQ,GAAI,QAAO;AAEpC,QAAI,OAAO,QAAQ,CAAC,MAAM,QAAW;AACnC,YAAMA,QAAO,OAAO,QAAQ,CAAC,CAAC;AAC9B,UAAIA,QAAO,KAAKA,QAAO,GAAI,QAAO;AAAA,IACpC;AACA,QAAI,OAAO,QAAQ,CAAC,MAAM,QAAW;AACnC,YAAM,QAAQ,OAAO,QAAQ,CAAC,CAAC;AAC/B,UAAI,QAAQ,KAAK,QAAQ,GAAI,QAAO;AAAA,IACtC;AAEA,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":["date"]}
|
package/dist/minuteEnd.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for end of the given minute.
|
|
5
|
-
* @param inputDate - A string or
|
|
5
|
+
* @param [inputDate] - A string, Date object or nothing for the current time
|
|
6
6
|
*/
|
|
7
|
-
declare function minuteEnd(inputDate
|
|
7
|
+
declare function minuteEnd(inputDate?: MaybeDateInput): Date;
|
|
8
8
|
|
|
9
9
|
export { minuteEnd };
|
package/dist/minuteEnd.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/minuteEnd.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/minuteEnd.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for end of the given minute.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function minuteEnd(inputDate?: MaybeDateInput): Date {\n const d = date(inputDate)\n d.setSeconds(59, 999)\n return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAOd,SAAS,UAAU,WAAkC;AAC1D,QAAM,IAAI,KAAK,SAAS;AACxB,IAAE,WAAW,IAAI,GAAG;AACpB,SAAO;AACT;","names":[]}
|
package/dist/minuteStart.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for start of the given minute.
|
|
5
|
-
* @param inputDate - A string or
|
|
5
|
+
* @param [inputDate] - A string, Date object or nothing for the current time
|
|
6
6
|
*/
|
|
7
|
-
declare function minuteStart(inputDate
|
|
7
|
+
declare function minuteStart(inputDate?: MaybeDateInput): Date;
|
|
8
8
|
|
|
9
9
|
export { minuteStart };
|
package/dist/minuteStart.mjs
CHANGED
package/dist/minuteStart.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/minuteStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/minuteStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for start of the given minute.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function minuteStart(inputDate?: MaybeDateInput): Date {\n const d = date(inputDate)\n d.setSeconds(0, 0)\n return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAOd,SAAS,YAAY,WAAkC;AAC5D,QAAM,IAAI,KAAK,SAAS;AACxB,IAAE,WAAW,GAAG,CAAC;AACjB,SAAO;AACT;","names":[]}
|
package/dist/monthDays.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns the total number of days from a given month.
|
|
5
|
-
* @param inputDate - A string or
|
|
5
|
+
* @param [inputDate] - A string, Date object or nothing for the current month
|
|
6
6
|
*/
|
|
7
|
-
declare function monthDays(inputDate
|
|
7
|
+
declare function monthDays(inputDate?: MaybeDateInput): number;
|
|
8
8
|
|
|
9
9
|
export { monthDays };
|
package/dist/monthDays.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/monthDays.ts"],"sourcesContent":["import { monthEnd } from \"./monthEnd\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/monthDays.ts"],"sourcesContent":["import { monthEnd } from \"./monthEnd\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns the total number of days from a given month.\n * @param [inputDate] - A string, Date object or nothing for the current month\n */\nexport function monthDays(inputDate?: MaybeDateInput): number {\n const d = monthEnd(inputDate)\n return d.getDate()\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAOlB,SAAS,UAAU,WAAoC;AAC5D,QAAM,IAAI,SAAS,SAAS;AAC5B,SAAO,EAAE,QAAQ;AACnB;","names":[]}
|
package/dist/monthEnd.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for the with the input date set to the last day of
|
|
5
5
|
* the current month. Does not change the time.
|
|
6
|
-
* @param inputDate - A string or
|
|
6
|
+
* @param [inputDate] - A string, Date object or nothing for the current month
|
|
7
7
|
*/
|
|
8
|
-
declare function monthEnd(inputDate
|
|
8
|
+
declare function monthEnd(inputDate?: MaybeDateInput): Date;
|
|
9
9
|
|
|
10
10
|
export { monthEnd };
|
package/dist/monthEnd.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/monthEnd.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/monthEnd.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the with the input date set to the last day of\n * the current month. Does not change the time.\n * @param [inputDate] - A string, Date object or nothing for the current month\n */\nexport function monthEnd(inputDate?: MaybeDateInput): Date {\n const d = date(inputDate)\n d.setDate(1)\n d.setMonth(d.getMonth() + 1)\n d.setDate(0)\n return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAQd,SAAS,SAAS,WAAkC;AACzD,QAAM,IAAI,KAAK,SAAS;AACxB,IAAE,QAAQ,CAAC;AACX,IAAE,SAAS,EAAE,SAAS,IAAI,CAAC;AAC3B,IAAE,QAAQ,CAAC;AACX,SAAO;AACT;","names":[]}
|
package/dist/monthStart.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a Date object for the first day of a month.
|
|
5
|
-
* @param inputDate - A string or
|
|
5
|
+
* @param [inputDate] - A string, Date object or nothing for the current time
|
|
6
6
|
*/
|
|
7
|
-
declare function monthStart(inputDate
|
|
7
|
+
declare function monthStart(inputDate?: MaybeDateInput): Date;
|
|
8
8
|
|
|
9
9
|
export { monthStart };
|
package/dist/monthStart.mjs
CHANGED
package/dist/monthStart.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/monthStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/monthStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for the first day of a month.\n * @param [inputDate] - A string, Date object or nothing for the current time\n */\nexport function monthStart(inputDate?: MaybeDateInput): Date {\n const d = date(inputDate)\n d.setDate(1)\n d.setHours(0, 0, 0, 0)\n return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAOd,SAAS,WAAW,WAAkC;AAC3D,QAAM,IAAI,KAAK,SAAS;AACxB,IAAE,QAAQ,CAAC;AACX,IAAE,SAAS,GAAG,GAAG,GAAG,CAAC;AACrB,SAAO;AACT;","names":[]}
|
package/dist/nearestDay.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MaybeDateInput } from './types.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Performs a bidirectional search for the nearest date that passes a function.
|
|
5
|
-
* @param
|
|
5
|
+
* @param [inputDate] - Performs a search for the nearest passing date.
|
|
6
6
|
* @param search - The search function to use, given a date returns a boolean.
|
|
7
7
|
* @param constraint - The number of iterations to perform before giving up, or logical constraint like "month", or "week".
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
declare function nearestDay(inputDate:
|
|
10
|
+
declare function nearestDay(inputDate: MaybeDateInput, search: (date: Date) => boolean, constraint?: number | "month" | "week" | "year"): Date | null;
|
|
11
11
|
|
|
12
12
|
export { nearestDay };
|
package/dist/nearestDay.mjs
CHANGED
|
@@ -29,13 +29,11 @@ function nearestDay(inputDate, search, constraint = 7) {
|
|
|
29
29
|
for (let i = 0; i <= increments || i < decrements; i++) {
|
|
30
30
|
if (i <= increments) {
|
|
31
31
|
const next = addDay(d, i);
|
|
32
|
-
if (search(next))
|
|
33
|
-
return next;
|
|
32
|
+
if (search(next)) return next;
|
|
34
33
|
}
|
|
35
34
|
if (i && i <= decrements) {
|
|
36
35
|
const prev = addDay(d, -i);
|
|
37
|
-
if (search(prev))
|
|
38
|
-
return prev;
|
|
36
|
+
if (search(prev)) return prev;
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
return null;
|
package/dist/nearestDay.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/nearestDay.ts"],"sourcesContent":["import { date } from \"./date\"\nimport { monthDays } from \"./monthDays\"\nimport { yearDays } from \"./yearDays\"\nimport { dayOfYear } from \"./dayOfYear\"\nimport { addDay } from \"./addDay\"\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/nearestDay.ts"],"sourcesContent":["import { date } from \"./date\"\nimport { monthDays } from \"./monthDays\"\nimport { yearDays } from \"./yearDays\"\nimport { dayOfYear } from \"./dayOfYear\"\nimport { addDay } from \"./addDay\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Performs a bidirectional search for the nearest date that passes a function.\n * @param [inputDate] - Performs a search for the nearest passing date.\n * @param search - The search function to use, given a date returns a boolean.\n * @param constraint - The number of iterations to perform before giving up, or logical constraint like \"month\", or \"week\".\n *\n */\nexport function nearestDay(\n inputDate: MaybeDateInput,\n search: (date: Date) => boolean,\n constraint: number | \"month\" | \"week\" | \"year\" = 7\n): Date | null {\n let increments: number\n let decrements: number\n const d = date(inputDate)\n switch (constraint) {\n case \"month\":\n decrements = d.getDate()\n increments = monthDays(d) - d.getDate()\n break\n case \"week\":\n decrements = d.getDay() + 1\n increments = 6 - d.getDay()\n break\n case \"year\":\n const total = yearDays(d)\n const day = dayOfYear(d)\n decrements = day\n increments = total - day\n break\n default:\n increments = decrements = constraint\n }\n\n for (let i = 0; i <= increments || i < decrements; i++) {\n if (i <= increments) {\n const next = addDay(d, i)\n if (search(next)) return next\n }\n if (i && i <= decrements) {\n const prev = addDay(d, -i)\n if (search(prev)) return prev\n }\n }\n return null\n}\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAUhB,SAAS,WACd,WACA,QACA,aAAiD,GACpC;AACb,MAAI;AACJ,MAAI;AACJ,QAAM,IAAI,KAAK,SAAS;AACxB,UAAQ,YAAY;AAAA,IAClB,KAAK;AACH,mBAAa,EAAE,QAAQ;AACvB,mBAAa,UAAU,CAAC,IAAI,EAAE,QAAQ;AACtC;AAAA,IACF,KAAK;AACH,mBAAa,EAAE,OAAO,IAAI;AAC1B,mBAAa,IAAI,EAAE,OAAO;AAC1B;AAAA,IACF,KAAK;AACH,YAAM,QAAQ,SAAS,CAAC;AACxB,YAAM,MAAM,UAAU,CAAC;AACvB,mBAAa;AACb,mBAAa,QAAQ;AACrB;AAAA,IACF;AACE,mBAAa,aAAa;AAAA,EAC9B;AAEA,WAAS,IAAI,GAAG,KAAK,cAAc,IAAI,YAAY,KAAK;AACtD,QAAI,KAAK,YAAY;AACnB,YAAM,OAAO,OAAO,GAAG,CAAC;AACxB,UAAI,OAAO,IAAI,EAAG,QAAO;AAAA,IAC3B;AACA,QAAI,KAAK,KAAK,YAAY;AACxB,YAAM,OAAO,OAAO,GAAG,CAAC,CAAC;AACzB,UAAI,OAAO,IAAI,EAAG,QAAO;AAAA,IAC3B;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/dist/offset.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { TimezoneToken } from './common.js';
|
|
2
|
-
import {
|
|
2
|
+
import { MaybeDateInput } from './types.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns the offset between two timezones on a given date. The results are
|
|
6
6
|
* ISO8601 compatible offsets like -0800 or +0530.
|
|
7
7
|
*
|
|
8
|
-
* @param dateInput - The date on which to determine the offset
|
|
9
|
-
* @param tzA - (default: UTC) The second timezone to compare determine the offset between.
|
|
10
|
-
* @param tzB - (default: device) The first timezone to compare determine the offset between.
|
|
8
|
+
* @param [dateInput] - (default: current time) The date on which to determine the offset
|
|
9
|
+
* @param [tzA] - (default: UTC) The second timezone to compare determine the offset between.
|
|
10
|
+
* @param [tzB] - (default: device) The first timezone to compare determine the offset between.
|
|
11
11
|
*/
|
|
12
|
-
declare function offset(utcTime
|
|
12
|
+
declare function offset(utcTime?: MaybeDateInput, tzA?: string, tzB?: string, timeZoneToken?: TimezoneToken): string;
|
|
13
13
|
|
|
14
14
|
export { offset };
|
package/dist/offset.mjs
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
// src/offset.ts
|
|
2
2
|
import { date } from "./date.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { secsToOffset } from "./common.mjs";
|
|
4
4
|
import { deviceTZ } from "./deviceTZ.mjs";
|
|
5
5
|
function relativeTime(d, timeZone) {
|
|
6
6
|
const utcParts = new Intl.DateTimeFormat("en-US", {
|
|
7
|
+
era: "short",
|
|
7
8
|
year: "numeric",
|
|
8
|
-
month: "
|
|
9
|
-
day: "
|
|
10
|
-
hour: "
|
|
11
|
-
minute: "
|
|
12
|
-
second: "
|
|
9
|
+
month: "numeric",
|
|
10
|
+
day: "numeric",
|
|
11
|
+
hour: "numeric",
|
|
12
|
+
minute: "numeric",
|
|
13
|
+
second: "numeric",
|
|
13
14
|
timeZone,
|
|
14
15
|
hourCycle: "h23"
|
|
15
|
-
}).formatToParts(d)
|
|
16
|
-
const
|
|
16
|
+
}).formatToParts(d);
|
|
17
|
+
const p = {};
|
|
17
18
|
utcParts.forEach((part) => {
|
|
18
|
-
|
|
19
|
+
if (part.type !== "literal") p[part.type] = part.value;
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
21
|
+
const year = p.era === "BC" ? 1 - Number(p.year) : Number(p.year);
|
|
22
|
+
const result = new Date(Date.UTC(0, 0, 1, Number(p.hour), Number(p.minute), Number(p.second)));
|
|
23
|
+
result.setUTCFullYear(year, Number(p.month) - 1, Number(p.day));
|
|
24
|
+
return result;
|
|
23
25
|
}
|
|
24
26
|
function offset(utcTime, tzA = "UTC", tzB = "device", timeZoneToken = "Z") {
|
|
25
27
|
var _a;
|
|
@@ -27,10 +29,8 @@ function offset(utcTime, tzA = "UTC", tzB = "device", timeZoneToken = "Z") {
|
|
|
27
29
|
const d = date(utcTime);
|
|
28
30
|
const timeA = relativeTime(d, tzA);
|
|
29
31
|
const timeB = relativeTime(d, tzB);
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
);
|
|
33
|
-
return minsToOffset(timeDiffInMins, timeZoneToken);
|
|
32
|
+
const timeDiffInSecs = Math.round((timeB.getTime() - timeA.getTime()) / 1e3);
|
|
33
|
+
return secsToOffset(timeDiffInSecs, timeZoneToken);
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
36
|
offset
|