@super-calendar/dom 2.17.0 → 2.18.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 +42 -2
- package/dist/index.d.mts +58 -16
- package/dist/index.d.ts +58 -16
- package/dist/index.js +398 -144
- package/dist/index.mjs +400 -146
- package/package.json +2 -2
- package/src/Agenda.tsx +18 -2
- package/src/Calendar.tsx +104 -29
- package/src/MonthView.tsx +182 -33
- package/src/TimeGrid.tsx +363 -153
- package/src/YearView.tsx +12 -1
package/src/YearView.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
monthCreateRange,
|
|
12
12
|
daySelectionState,
|
|
13
13
|
getIsToday,
|
|
14
|
+
nowInTimeZone,
|
|
14
15
|
filterHiddenDays,
|
|
15
16
|
getWeekDays,
|
|
16
17
|
getYearMonths,
|
|
@@ -59,6 +60,13 @@ export interface YearViewProps<T = unknown>
|
|
|
59
60
|
/** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
|
|
60
61
|
hiddenDays?: number[];
|
|
61
62
|
locale?: Locale;
|
|
63
|
+
/**
|
|
64
|
+
* The instant whose calendar day is highlighted as today. Defaults to the
|
|
65
|
+
* device clock, and is read in `timeZone` when one is set.
|
|
66
|
+
*/
|
|
67
|
+
now?: Date;
|
|
68
|
+
/** Highlight today as it is in this IANA time zone (default: the device's). */
|
|
69
|
+
timeZone?: string;
|
|
62
70
|
/** Translations for the screen-reader words; omitted keys use English. */
|
|
63
71
|
labels?: Partial<CalendarLabels>;
|
|
64
72
|
/** Highlight this date instead of the real "today". */
|
|
@@ -111,6 +119,8 @@ export function YearView<T = unknown>({
|
|
|
111
119
|
weekStartsOn = 0,
|
|
112
120
|
hiddenDays,
|
|
113
121
|
locale,
|
|
122
|
+
now,
|
|
123
|
+
timeZone,
|
|
114
124
|
labels: labelsProp,
|
|
115
125
|
activeDate,
|
|
116
126
|
selectedRange,
|
|
@@ -179,6 +189,7 @@ export function YearView<T = unknown>({
|
|
|
179
189
|
return () => window.removeEventListener("pointerup", finish);
|
|
180
190
|
}, [isCreating, onCreateEvent]);
|
|
181
191
|
|
|
192
|
+
const today = nowInTimeZone(now, timeZone);
|
|
182
193
|
const months = useMemo(() => getYearMonths(date), [date]);
|
|
183
194
|
const weekdayLabels = useMemo(
|
|
184
195
|
() =>
|
|
@@ -294,7 +305,7 @@ export function YearView<T = unknown>({
|
|
|
294
305
|
/>
|
|
295
306
|
);
|
|
296
307
|
}
|
|
297
|
-
const isToday = getIsToday(day);
|
|
308
|
+
const isToday = getIsToday(day, today);
|
|
298
309
|
const isHighlighted = activeDate
|
|
299
310
|
? isSameCalendarDay(day, activeDate)
|
|
300
311
|
: isToday;
|