nodebb-plugin-onekite-calendar 2.0.7 → 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 CHANGED
@@ -1,5 +1,8 @@
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
+
3
6
  ## 1.2.14
4
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 ».
5
8
 
package/lib/api.js CHANGED
@@ -356,8 +356,22 @@ function eventsFor(resv) {
356
356
  const status = resv.status;
357
357
  const icons = { pending: '⏳', awaiting_payment: '💳', paid: '✅' };
358
358
  const colors = { pending: '#f39c12', awaiting_payment: '#d35400', paid: '#27ae60' };
359
- const startIsoDate = new Date(parseInt(resv.start, 10)).toISOString().slice(0, 10);
360
- const endIsoDate = new Date(parseInt(resv.end, 10)).toISOString().slice(0, 10);
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);
361
375
 
362
376
  const itemIds = Array.isArray(resv.itemIds) ? resv.itemIds : (resv.itemId ? [resv.itemId] : []);
363
377
  const itemNames = Array.isArray(resv.itemNames) ? resv.itemNames : (resv.itemName ? [resv.itemName] : []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "FullCalendar-based equipment reservation workflow with admin approval & HelloAsso payment for NodeBB",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "acpScripts": [
40
40
  "public/admin.js"
41
41
  ],
42
- "version": "2.0.7"
42
+ "version": "2.0.8"
43
43
  }