@super-calendar/core 2.14.1 → 2.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -12
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
- package/src/utils/drag.ts +16 -14
package/dist/index.js
CHANGED
|
@@ -553,18 +553,6 @@ function clampMoveStartMinutes(startMinutes, minHour, maxHour, snapMinutes) {
|
|
|
553
553
|
const upper = Math.max(lower, maxHour * 60 - snapMinutes);
|
|
554
554
|
return Math.min(Math.max(startMinutes, lower), upper);
|
|
555
555
|
}
|
|
556
|
-
/**
|
|
557
|
-
* A copy of `date` shifted by `minutes` (may be negative) on the clock, so a
|
|
558
|
-
* shift across a DST change keeps the clock time. When the resulting clock time
|
|
559
|
-
* occurs twice (the hour a fall-back change repeats), the occurrence nearer to
|
|
560
|
-
* `minutes` of elapsed time wins.
|
|
561
|
-
*/
|
|
562
|
-
function shiftMinutes(date, minutes) {
|
|
563
|
-
"worklet";
|
|
564
|
-
const next = new Date(date);
|
|
565
|
-
next.setMinutes(next.getMinutes() + minutes);
|
|
566
|
-
return nearestOccurrence(next, date.getTime() + minutes * 6e4);
|
|
567
|
-
}
|
|
568
556
|
function nearestOccurrence(date, target) {
|
|
569
557
|
"worklet";
|
|
570
558
|
const offset = date.getTimezoneOffset();
|
|
@@ -579,6 +567,18 @@ function nearestOccurrence(date, target) {
|
|
|
579
567
|
}
|
|
580
568
|
return best;
|
|
581
569
|
}
|
|
570
|
+
/**
|
|
571
|
+
* A copy of `date` shifted by `minutes` (may be negative) on the clock, so a
|
|
572
|
+
* shift across a DST change keeps the clock time. When the resulting clock time
|
|
573
|
+
* occurs twice (the hour a fall-back change repeats), the occurrence nearer to
|
|
574
|
+
* `minutes` of elapsed time wins.
|
|
575
|
+
*/
|
|
576
|
+
function shiftMinutes(date, minutes) {
|
|
577
|
+
"worklet";
|
|
578
|
+
const next = new Date(date);
|
|
579
|
+
next.setMinutes(next.getMinutes() + minutes);
|
|
580
|
+
return nearestOccurrence(next, date.getTime() + minutes * 6e4);
|
|
581
|
+
}
|
|
582
582
|
const localTime = (date) => date.getTime() - date.getTimezoneOffset() * 6e4;
|
|
583
583
|
/**
|
|
584
584
|
* Where moving `[start, end]` by `minutes` on the clock lands, in clock hours:
|
package/dist/index.mjs
CHANGED
|
@@ -552,18 +552,6 @@ function clampMoveStartMinutes(startMinutes, minHour, maxHour, snapMinutes) {
|
|
|
552
552
|
const upper = Math.max(lower, maxHour * 60 - snapMinutes);
|
|
553
553
|
return Math.min(Math.max(startMinutes, lower), upper);
|
|
554
554
|
}
|
|
555
|
-
/**
|
|
556
|
-
* A copy of `date` shifted by `minutes` (may be negative) on the clock, so a
|
|
557
|
-
* shift across a DST change keeps the clock time. When the resulting clock time
|
|
558
|
-
* occurs twice (the hour a fall-back change repeats), the occurrence nearer to
|
|
559
|
-
* `minutes` of elapsed time wins.
|
|
560
|
-
*/
|
|
561
|
-
function shiftMinutes(date, minutes) {
|
|
562
|
-
"worklet";
|
|
563
|
-
const next = new Date(date);
|
|
564
|
-
next.setMinutes(next.getMinutes() + minutes);
|
|
565
|
-
return nearestOccurrence(next, date.getTime() + minutes * 6e4);
|
|
566
|
-
}
|
|
567
555
|
function nearestOccurrence(date, target) {
|
|
568
556
|
"worklet";
|
|
569
557
|
const offset = date.getTimezoneOffset();
|
|
@@ -578,6 +566,18 @@ function nearestOccurrence(date, target) {
|
|
|
578
566
|
}
|
|
579
567
|
return best;
|
|
580
568
|
}
|
|
569
|
+
/**
|
|
570
|
+
* A copy of `date` shifted by `minutes` (may be negative) on the clock, so a
|
|
571
|
+
* shift across a DST change keeps the clock time. When the resulting clock time
|
|
572
|
+
* occurs twice (the hour a fall-back change repeats), the occurrence nearer to
|
|
573
|
+
* `minutes` of elapsed time wins.
|
|
574
|
+
*/
|
|
575
|
+
function shiftMinutes(date, minutes) {
|
|
576
|
+
"worklet";
|
|
577
|
+
const next = new Date(date);
|
|
578
|
+
next.setMinutes(next.getMinutes() + minutes);
|
|
579
|
+
return nearestOccurrence(next, date.getTime() + minutes * 6e4);
|
|
580
|
+
}
|
|
581
581
|
const localTime = (date) => date.getTime() - date.getTimezoneOffset() * 6e4;
|
|
582
582
|
/**
|
|
583
583
|
* Where moving `[start, end]` by `minutes` on the clock lands, in clock hours:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-calendar/core",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.2",
|
|
4
4
|
"description": "Render-agnostic core for super-calendar: date math, selection model, event layout, the month-grid builder, headless hooks, and neutral theme tokens. No renderer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"calendar",
|
package/src/utils/drag.ts
CHANGED
|
@@ -79,22 +79,11 @@ export function clampMoveStartMinutes(
|
|
|
79
79
|
return Math.min(Math.max(startMinutes, lower), upper);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
* A copy of `date` shifted by `minutes` (may be negative) on the clock, so a
|
|
84
|
-
* shift across a DST change keeps the clock time. When the resulting clock time
|
|
85
|
-
* occurs twice (the hour a fall-back change repeats), the occurrence nearer to
|
|
86
|
-
* `minutes` of elapsed time wins.
|
|
87
|
-
*/
|
|
88
|
-
export function shiftMinutes(date: Date, minutes: number): Date {
|
|
89
|
-
"worklet";
|
|
90
|
-
const next = new Date(date);
|
|
91
|
-
next.setMinutes(next.getMinutes() + minutes);
|
|
92
|
-
return nearestOccurrence(next, date.getTime() + minutes * 60_000);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
82
|
// The instant reading the same clock time as `date` that is nearest `target`
|
|
96
83
|
// (ms). In the hour a fall-back change repeats a clock time names two instants,
|
|
97
|
-
// one offset change apart; elsewhere this is `date`.
|
|
84
|
+
// one offset change apart; elsewhere this is `date`. Declared before the
|
|
85
|
+
// worklets that call it: the worklets plugin captures a worklet's dependencies
|
|
86
|
+
// when the module is evaluated, so a later declaration is still undefined.
|
|
98
87
|
function nearestOccurrence(date: Date, target: number): Date {
|
|
99
88
|
"worklet";
|
|
100
89
|
const offset = date.getTimezoneOffset();
|
|
@@ -110,6 +99,19 @@ function nearestOccurrence(date: Date, target: number): Date {
|
|
|
110
99
|
return best;
|
|
111
100
|
}
|
|
112
101
|
|
|
102
|
+
/**
|
|
103
|
+
* A copy of `date` shifted by `minutes` (may be negative) on the clock, so a
|
|
104
|
+
* shift across a DST change keeps the clock time. When the resulting clock time
|
|
105
|
+
* occurs twice (the hour a fall-back change repeats), the occurrence nearer to
|
|
106
|
+
* `minutes` of elapsed time wins.
|
|
107
|
+
*/
|
|
108
|
+
export function shiftMinutes(date: Date, minutes: number): Date {
|
|
109
|
+
"worklet";
|
|
110
|
+
const next = new Date(date);
|
|
111
|
+
next.setMinutes(next.getMinutes() + minutes);
|
|
112
|
+
return nearestOccurrence(next, date.getTime() + minutes * 60_000);
|
|
113
|
+
}
|
|
114
|
+
|
|
113
115
|
// `date`'s clock reading as milliseconds, equal for two instants that read the same.
|
|
114
116
|
const localTime = (date: Date): number => date.getTime() - date.getTimezoneOffset() * 60_000;
|
|
115
117
|
|