@gobrand/calendar-core 0.0.18 → 0.0.19

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.cjs CHANGED
@@ -177,6 +177,7 @@ function buildMonth(year, month, options) {
177
177
  }
178
178
  const dateKey = currentDate.toString();
179
179
  weeks[weeks.length - 1].push({
180
+ id: `${yearMonth.toString()}-${dateKey}`,
180
181
  date: currentDate,
181
182
  isCurrentMonth: currentDate.month === month,
182
183
  isToday: import_polyfill2.Temporal.PlainDate.compare(currentDate, today) === 0,
@@ -218,6 +219,7 @@ function buildDay(date, options) {
218
219
  }
219
220
  }
220
221
  const timeSlots = [];
222
+ const dateStr = date.toString();
221
223
  let currentHour = startHour;
222
224
  let currentMinute = 0;
223
225
  while (currentHour < endHour) {
@@ -244,6 +246,7 @@ function buildDay(date, options) {
244
246
  }
245
247
  }
246
248
  timeSlots.push({
249
+ id: `${dateStr}-${String(currentHour).padStart(2, "0")}:${String(currentMinute).padStart(2, "0")}`,
247
250
  hour: currentHour,
248
251
  minute: currentMinute,
249
252
  time: slotStart,
@@ -256,6 +259,7 @@ function buildDay(date, options) {
256
259
  }
257
260
  }
258
261
  return {
262
+ id: dateStr,
259
263
  date,
260
264
  isToday: import_polyfill3.Temporal.PlainDate.compare(date, today) === 0,
261
265
  timeSlots,
@@ -302,6 +306,7 @@ function buildWeek(date, options) {
302
306
  timeSlots = dayView.timeSlots;
303
307
  }
304
308
  days.push({
309
+ id: `${weekStart.toString()}-${dateKey}`,
305
310
  date: currentDate,
306
311
  isToday: import_polyfill4.Temporal.PlainDate.compare(currentDate, today) === 0,
307
312
  items: itemsByDate.get(dateKey) ?? [],
package/dist/index.d.cts CHANGED
@@ -7,6 +7,8 @@ type CalendarAccessor<TItem> = {
7
7
  getEnd?: (item: TItem) => Temporal.ZonedDateTime;
8
8
  };
9
9
  type CalendarDay<TItem = unknown> = {
10
+ /** Unique identifier for this day within the view context. Use as React/Vue key. */
11
+ id: string;
10
12
  date: Temporal.PlainDate;
11
13
  isCurrentMonth: boolean;
12
14
  isToday: boolean;
@@ -18,6 +20,8 @@ type CalendarMonth<TItem = unknown> = {
18
20
  month: Temporal.PlainYearMonth;
19
21
  };
20
22
  type WeekDay<TItem = unknown> = {
23
+ /** Unique identifier for this day within the view context. Use as React/Vue key. */
24
+ id: string;
21
25
  date: Temporal.PlainDate;
22
26
  isToday: boolean;
23
27
  items: TItem[];
@@ -29,12 +33,16 @@ type CalendarWeekView<TItem = unknown> = {
29
33
  weekEnd: Temporal.PlainDate;
30
34
  };
31
35
  type TimeSlot<TItem = unknown> = {
36
+ /** Unique identifier for this time slot. Use as React/Vue key. */
37
+ id: string;
32
38
  hour: number;
33
39
  minute: number;
34
40
  time: Temporal.PlainTime;
35
41
  items: TItem[];
36
42
  };
37
43
  type CalendarDayView<TItem = unknown> = {
44
+ /** Unique identifier for this day view. Use as React/Vue key. */
45
+ id: string;
38
46
  date: Temporal.PlainDate;
39
47
  isToday: boolean;
40
48
  timeSlots: TimeSlot<TItem>[];
package/dist/index.d.ts CHANGED
@@ -7,6 +7,8 @@ type CalendarAccessor<TItem> = {
7
7
  getEnd?: (item: TItem) => Temporal.ZonedDateTime;
8
8
  };
9
9
  type CalendarDay<TItem = unknown> = {
10
+ /** Unique identifier for this day within the view context. Use as React/Vue key. */
11
+ id: string;
10
12
  date: Temporal.PlainDate;
11
13
  isCurrentMonth: boolean;
12
14
  isToday: boolean;
@@ -18,6 +20,8 @@ type CalendarMonth<TItem = unknown> = {
18
20
  month: Temporal.PlainYearMonth;
19
21
  };
20
22
  type WeekDay<TItem = unknown> = {
23
+ /** Unique identifier for this day within the view context. Use as React/Vue key. */
24
+ id: string;
21
25
  date: Temporal.PlainDate;
22
26
  isToday: boolean;
23
27
  items: TItem[];
@@ -29,12 +33,16 @@ type CalendarWeekView<TItem = unknown> = {
29
33
  weekEnd: Temporal.PlainDate;
30
34
  };
31
35
  type TimeSlot<TItem = unknown> = {
36
+ /** Unique identifier for this time slot. Use as React/Vue key. */
37
+ id: string;
32
38
  hour: number;
33
39
  minute: number;
34
40
  time: Temporal.PlainTime;
35
41
  items: TItem[];
36
42
  };
37
43
  type CalendarDayView<TItem = unknown> = {
44
+ /** Unique identifier for this day view. Use as React/Vue key. */
45
+ id: string;
38
46
  date: Temporal.PlainDate;
39
47
  isToday: boolean;
40
48
  timeSlots: TimeSlot<TItem>[];
package/dist/index.js CHANGED
@@ -123,6 +123,7 @@ function buildMonth(year, month, options) {
123
123
  }
124
124
  const dateKey = currentDate.toString();
125
125
  weeks[weeks.length - 1].push({
126
+ id: `${yearMonth.toString()}-${dateKey}`,
126
127
  date: currentDate,
127
128
  isCurrentMonth: currentDate.month === month,
128
129
  isToday: Temporal2.PlainDate.compare(currentDate, today) === 0,
@@ -164,6 +165,7 @@ function buildDay(date, options) {
164
165
  }
165
166
  }
166
167
  const timeSlots = [];
168
+ const dateStr = date.toString();
167
169
  let currentHour = startHour;
168
170
  let currentMinute = 0;
169
171
  while (currentHour < endHour) {
@@ -190,6 +192,7 @@ function buildDay(date, options) {
190
192
  }
191
193
  }
192
194
  timeSlots.push({
195
+ id: `${dateStr}-${String(currentHour).padStart(2, "0")}:${String(currentMinute).padStart(2, "0")}`,
193
196
  hour: currentHour,
194
197
  minute: currentMinute,
195
198
  time: slotStart,
@@ -202,6 +205,7 @@ function buildDay(date, options) {
202
205
  }
203
206
  }
204
207
  return {
208
+ id: dateStr,
205
209
  date,
206
210
  isToday: Temporal3.PlainDate.compare(date, today) === 0,
207
211
  timeSlots,
@@ -248,6 +252,7 @@ function buildWeek(date, options) {
248
252
  timeSlots = dayView.timeSlots;
249
253
  }
250
254
  days.push({
255
+ id: `${weekStart.toString()}-${dateKey}`,
251
256
  date: currentDate,
252
257
  isToday: Temporal4.PlainDate.compare(currentDate, today) === 0,
253
258
  items: itemsByDate.get(dateKey) ?? [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobrand/calendar-core",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Lightweight utility library for building calendars using the Temporal API",
5
5
  "private": false,
6
6
  "publishConfig": {