nodebb-plugin-onekite-calendar 2.0.9 → 2.0.10

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.17
4
+ - Modale réservation : la requête de disponibilité initiale utilise aussi des dates calendaires (YYYY-MM-DD) au lieu de startStr/endStr/toISOString(), ce qui corrige le grisé erroné (mobile + durée rapide).
5
+
3
6
  ## 1.2.16
4
7
  - Modale réservation (Durée rapide) : correction du grisé erroné des matériels réservés la veille. Les requêtes de disponibilité utilisent désormais des dates calendaires (YYYY-MM-DD) au lieu de toISOString() (UTC), pour éviter tout faux chevauchement lié au fuseau/DST.
5
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
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.9"
42
+ "version": "2.0.10"
43
43
  }
package/public/client.js CHANGED
@@ -837,6 +837,13 @@ function toDatetimeLocalValue(date) {
837
837
  const start = selectionInfo.start;
838
838
  let end = selectionInfo.end;
839
839
 
840
+ // In some FullCalendar flows (notably on mobile), selectionInfo.end can be undefined.
841
+ // For all-day bookings, end is always treated as EXCLUSIVE.
842
+ if (!end) {
843
+ end = new Date(start);
844
+ end.setDate(end.getDate() + 1);
845
+ }
846
+
840
847
  // Days (end is exclusive in FullCalendar) — compute in calendar days only
841
848
  // (no dependency on hours, timezone or DST).
842
849
  let days = calendarDaysExclusive(start, end);
@@ -844,9 +851,13 @@ function toDatetimeLocalValue(date) {
844
851
  // Fetch existing events overlapping the selection to disable already reserved items.
845
852
  let blocked = new Set();
846
853
  try {
854
+ // IMPORTANT: never use toISOString() for availability checks.
855
+ // Local midnight in Europe/Paris becomes 23:00Z/22:00Z depending on DST, which makes
856
+ // consecutive all-day ranges appear to overlap and wrongly greys out items.
857
+ // Always query using calendar dates (YYYY-MM-DD) with end exclusive.
847
858
  const qs = new URLSearchParams({
848
- start: (selectionInfo.startStr || (start instanceof Date ? start.toISOString() : String(start))),
849
- end: (selectionInfo.endStr || (end instanceof Date ? end.toISOString() : String(end))),
859
+ start: toLocalYmd(start),
860
+ end: toLocalYmd(end),
850
861
  });
851
862
  const evs = await fetchJson(`/api/v3/plugins/calendar-onekite/events?${qs.toString()}`);
852
863
  (evs || []).forEach((ev) => {