nodebb-plugin-equipment-calendar 8.1.6 → 8.1.7

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/library.js CHANGED
@@ -1258,6 +1258,9 @@ async function handleCreateReservation(req, res) {
1258
1258
  let endMs = Date.UTC(end.getUTCFullYear(), end.getUTCMonth(), end.getUTCDate());
1259
1259
  if (endMs <= startMs) endMs = startMs + 24 * 60 * 60 * 1000;
1260
1260
 
1261
+ const endMsInclusive = endMs;
1262
+ const endMsExclusive = endMsInclusive + 24 * 60 * 60 * 1000;
1263
+ endMs = endMsExclusive;
1261
1264
  const days = Math.max(1, Math.round((endMs - startMs) / (24 * 60 * 60 * 1000)));
1262
1265
 
1263
1266
  const items = await getActiveItems(settings);
@@ -1282,7 +1285,7 @@ async function handleCreateReservation(req, res) {
1282
1285
  startMs,
1283
1286
  endMs,
1284
1287
  startIso: new Date(startMs).toISOString().slice(0, 10),
1285
- endIso: new Date(endMs).toISOString().slice(0, 10),
1288
+ endIso: new Date(endMs - 24*60*60*1000).toISOString().slice(0, 10),
1286
1289
  days,
1287
1290
  unitPrice,
1288
1291
  total,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-equipment-calendar",
3
- "version": "8.1.6",
3
+ "version": "8.1.7",
4
4
  "description": "Equipment reservation calendar for NodeBB (FullCalendar, approvals, HelloAsso payments)",
5
5
  "main": "library.js",
6
6
  "scripts": {
package/plugin.json CHANGED
@@ -25,6 +25,6 @@
25
25
  "scripts": [
26
26
  "public/js/client.js"
27
27
  ],
28
- "version": "3.0.0-stable4d-ui",
28
+ "version": "3.0.0-stable4e-delete-rangefix",
29
29
  "minver": "4.7.1"
30
30
  }
@@ -28,7 +28,17 @@ require(['jquery', 'bootstrap'], function ($, bootstrap) {
28
28
  return days > 0 ? days : 1;
29
29
  }
30
30
 
31
- function updateTotalPrice() {
31
+
32
+ function ecSubtractOneDay(iso) {
33
+ try {
34
+ if (!iso) return iso;
35
+ const d = new Date(iso + 'T00:00:00Z');
36
+ d.setUTCDate(d.getUTCDate() - 1);
37
+ return d.toISOString().slice(0,10);
38
+ } catch (e) { return iso; }
39
+ }
40
+
41
+ function updateTotalPrice() {
32
42
  try {
33
43
  const sel = document.getElementById('ec-item-ids');
34
44
  const out = document.getElementById('ec-total');
@@ -41,7 +51,7 @@ require(['jquery', 'bootstrap'], function ($, bootstrap) {
41
51
  let days = 1;
42
52
  if (start && end) {
43
53
  const ms = end.getTime() - start.getTime();
44
- days = Math.max(1, Math.round(ms / (24 * 60 * 60 * 1000)));
54
+ days = Math.max(1, Math.round(ms / (24 * 60 * 60 * 1000)) + 1);
45
55
  }
46
56
 
47
57
  let sum = 0;