@forcecalendar/core 2.1.21 → 2.1.22
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/core/events/EventStore.js +24 -3
- package/package.json +1 -1
|
@@ -234,9 +234,30 @@ export class EventStore {
|
|
|
234
234
|
|
|
235
235
|
// Filter by month
|
|
236
236
|
if (filters.month && filters.year) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
// Collect candidates from target month AND adjacent months to handle
|
|
238
|
+
// timezone boundary issues (events indexed in the event's own timezone
|
|
239
|
+
// may fall in a different month than the query month)
|
|
240
|
+
const candidateIds = new Set();
|
|
241
|
+
for (let offset = -1; offset <= 1; offset++) {
|
|
242
|
+
let m = filters.month + offset;
|
|
243
|
+
let y = filters.year;
|
|
244
|
+
if (m < 1) { m = 12; y--; }
|
|
245
|
+
if (m > 12) { m = 1; y++; }
|
|
246
|
+
const key = `${y}-${String(m).padStart(2, '0')}`;
|
|
247
|
+
const ids = this.indices.byMonth.get(key);
|
|
248
|
+
if (ids) {
|
|
249
|
+
ids.forEach(id => candidateIds.add(id));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Post-filter: only include events that actually overlap with the requested month
|
|
254
|
+
const monthStart = new Date(filters.year, filters.month - 1, 1);
|
|
255
|
+
const monthEnd = new Date(filters.year, filters.month, 0, 23, 59, 59, 999);
|
|
256
|
+
|
|
257
|
+
results = results.filter(event => {
|
|
258
|
+
if (!candidateIds.has(event.id)) return false;
|
|
259
|
+
return event.start <= monthEnd && event.end >= monthStart;
|
|
260
|
+
});
|
|
240
261
|
}
|
|
241
262
|
|
|
242
263
|
// Filter by all-day events
|