nodebb-plugin-onekite-calendar 2.0.6 → 2.0.8
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/CHANGELOG.md +6 -0
- package/lib/api.js +30 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog – calendar-onekite
|
|
2
2
|
|
|
3
|
+
## 1.2.15
|
|
4
|
+
- Réservations (Durée rapide) : génération des évènements all-day basée sur startDate/endDate (YYYY-MM-DD) quand disponibles, pour éviter tout décalage lié à toISOString() (UTC) et empêcher un grisé « non disponible » le jour suivant.
|
|
5
|
+
|
|
6
|
+
## 1.2.14
|
|
7
|
+
- Réservations : correction d’un faux chevauchement (problème 1h) quand FullCalendar envoie des bornes all-day à minuit UTC (Z / +00:00) — le lendemain n’est plus marqué « non disponible ».
|
|
8
|
+
|
|
3
9
|
## 1.2.13
|
|
4
10
|
- ACP (mode sombre) : correction de la visibilité de la liste d’autocomplete d’adresse (couleurs via variables Bootstrap)
|
|
5
11
|
|
package/lib/api.js
CHANGED
|
@@ -214,6 +214,20 @@ function toTs(v) {
|
|
|
214
214
|
const s = String(v).trim();
|
|
215
215
|
if (/^[0-9]+$/.test(s)) return parseInt(s, 10);
|
|
216
216
|
|
|
217
|
+
// IMPORTANT (all-day boundaries / FullCalendar):
|
|
218
|
+
// Depending on FullCalendar config (or how dates are built), all-day range
|
|
219
|
+
// boundaries can arrive as an ISO string at **midnight UTC** (Z or +00:00).
|
|
220
|
+
// Example: 2026-01-11T00:00:00.000Z
|
|
221
|
+
// In Europe/Paris this is 01:00 local, which makes consecutive all-day ranges
|
|
222
|
+
// appear to overlap by 1 hour and wrongly marks the next day as unavailable.
|
|
223
|
+
// When we detect a midnight-UTC boundary, we treat it as a calendar date and
|
|
224
|
+
// convert to **local midnight** for overlap computations.
|
|
225
|
+
const mUtcMidnight = /^((\d{4}-\d{2}-\d{2}))T00:00:00(?:\.\d{1,3})?(?:Z|\+00:00)$/.exec(s);
|
|
226
|
+
if (mUtcMidnight && mUtcMidnight[1]) {
|
|
227
|
+
const dLocal = new Date(mUtcMidnight[1] + 'T00:00:00');
|
|
228
|
+
return dLocal.getTime();
|
|
229
|
+
}
|
|
230
|
+
|
|
217
231
|
// IMPORTANT: Date-only strings like "2026-01-09" are interpreted as UTC by JS Date(),
|
|
218
232
|
// which can create 1h overlaps in Europe/Paris (and other TZs) between consecutive days.
|
|
219
233
|
// We treat date-only inputs as local-midnight by appending a time component.
|
|
@@ -342,8 +356,22 @@ function eventsFor(resv) {
|
|
|
342
356
|
const status = resv.status;
|
|
343
357
|
const icons = { pending: '⏳', awaiting_payment: '💳', paid: '✅' };
|
|
344
358
|
const colors = { pending: '#f39c12', awaiting_payment: '#d35400', paid: '#27ae60' };
|
|
345
|
-
|
|
346
|
-
|
|
359
|
+
// IMPORTANT:
|
|
360
|
+
// Prefer stored date-only strings when available.
|
|
361
|
+
//
|
|
362
|
+
// Rationale: when reservations are stored as local-midnight timestamps (because
|
|
363
|
+
// the client sends YYYY-MM-DD), converting those timestamps with toISOString()
|
|
364
|
+
// shifts the date in Europe/Paris (UTC+1/+2) and can make ranges appear to
|
|
365
|
+
// overlap the following day in some UI flows (notably "Durée rapide").
|
|
366
|
+
//
|
|
367
|
+
// FullCalendar expects `end` to be EXCLUSIVE for all-day ranges, so we keep
|
|
368
|
+
// using the stored endDate as-is.
|
|
369
|
+
const startIsoDate = (resv.startDate && /^\d{4}-\d{2}-\d{2}$/.test(String(resv.startDate)))
|
|
370
|
+
? String(resv.startDate)
|
|
371
|
+
: new Date(parseInt(resv.start, 10)).toISOString().slice(0, 10);
|
|
372
|
+
const endIsoDate = (resv.endDate && /^\d{4}-\d{2}-\d{2}$/.test(String(resv.endDate)))
|
|
373
|
+
? String(resv.endDate)
|
|
374
|
+
: new Date(parseInt(resv.end, 10)).toISOString().slice(0, 10);
|
|
347
375
|
|
|
348
376
|
const itemIds = Array.isArray(resv.itemIds) ? resv.itemIds : (resv.itemId ? [resv.itemId] : []);
|
|
349
377
|
const itemNames = Array.isArray(resv.itemNames) ? resv.itemNames : (resv.itemName ? [resv.itemName] : []);
|
package/package.json
CHANGED
package/plugin.json
CHANGED