nodebb-plugin-onekite-calendar 2.0.8 → 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,11 @@
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
+
6
+ ## 1.2.16
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.
8
+
3
9
  ## 1.2.15
4
10
  - 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
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.8",
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.8"
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) => {
@@ -960,9 +971,16 @@ function toDatetimeLocalValue(date) {
960
971
 
961
972
  function rangeQuery(s, e) {
962
973
  try {
963
- const sIso = (s instanceof Date) ? s.toISOString() : new Date(s).toISOString();
964
- const eIso = (e instanceof Date) ? e.toISOString() : new Date(e).toISOString();
965
- return new URLSearchParams({ start: sIso, end: eIso }).toString();
974
+ // IMPORTANT: For availability checks we must avoid ISO strings with timezone
975
+ // (e.g. toISOString()) because local midnight in Europe/Paris becomes
976
+ // 23:00Z or 22:00Z depending on DST, which makes consecutive all-day ranges
977
+ // appear to overlap and wrongly greys out items.
978
+ //
979
+ // We always query using *calendar dates* (YYYY-MM-DD) with end exclusive,
980
+ // matching FullCalendar's all-day rule.
981
+ const sYmd = toLocalYmd(s);
982
+ const eYmd = toLocalYmd(e);
983
+ return new URLSearchParams({ start: sYmd, end: eYmd }).toString();
966
984
  } catch (err) {
967
985
  return '';
968
986
  }