nodebb-plugin-equipment-calendar 8.9.2 → 8.9.4

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
@@ -1328,15 +1328,26 @@ async function handleCreateReservation(req, res) {
1328
1328
  const itemIds = normalizeItemIds(itemIdsRaw);
1329
1329
  if (!itemIds.length) return res.status(400).send('itemIds required');
1330
1330
 
1331
- // Dates expected as YYYY-MM-DD (end inclusive in UI)
1332
- const startIso = String(req.body.start || req.body.startDate || req.body.startIso || '').trim();
1333
- const endIso = String(req.body.end || req.body.endDate || req.body.endIso || '').trim();
1334
- if (!/^\d{4}-\d{2}-\d{2}$/.test(startIso) || !/^\d{4}-\d{2}-\d{2}$/.test(endIso)) {
1331
+ // Dates: accept YYYY-MM-DD or ISO-with-time; take first 10 chars
1332
+ let _startIso = String(req.body.start || req.body.startDate || req.body.startIso || req.body.startStr || '').trim().slice(0, 10);
1333
+ let _endIso = String(req.body.end || req.body.endDate || req.body.endIso || req.body.endStr || '').trim().slice(0, 10);
1334
+
1335
+ // Fallback: timestamps
1336
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(_startIso)) {
1337
+ const ms = Number(req.body.startMs || req.body.startTime || 0);
1338
+ if (ms) _startIso = new Date(ms).toISOString().slice(0, 10);
1339
+ }
1340
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(_endIso)) {
1341
+ const ms = Number(req.body.endMs || req.body.endTime || 0);
1342
+ if (ms) _endIso = new Date(ms).toISOString().slice(0, 10);
1343
+ }
1344
+
1345
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(_startIso) || !/^\d{4}-\d{2}-\d{2}$/.test(_endIso)) {
1335
1346
  return res.status(400).send('dates required');
1336
1347
  }
1337
1348
 
1338
- const startMs = Date.parse(startIso + 'T00:00:00Z');
1339
- const endMs = Date.parse(addDaysIso(endIso, 1) + 'T00:00:00Z'); // exclusive end
1349
+ const startMs = Date.parse(_startIso + 'T00:00:00Z');
1350
+ const endMs = Date.parse(addDaysIso(_endIso, 1) + 'T00:00:00Z'); // exclusive end
1340
1351
  if (!startMs || !endMs || endMs <= startMs) {
1341
1352
  return res.status(400).send('dates required');
1342
1353
  }
@@ -1364,8 +1375,8 @@ async function handleCreateReservation(req, res) {
1364
1375
  itemId,
1365
1376
  startMs,
1366
1377
  endMs,
1367
- startIso,
1368
- endIso,
1378
+ startIso: _startIso,
1379
+ endIso: _endIso,
1369
1380
  days,
1370
1381
  unitPrice,
1371
1382
  total,
@@ -1385,6 +1396,7 @@ async function handleCreateReservation(req, res) {
1385
1396
  }
1386
1397
 
1387
1398
 
1399
+
1388
1400
  async function handleApproveReservation(req, res) {
1389
1401
  try {
1390
1402
  const settings = await getSettings();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-equipment-calendar",
3
- "version": "8.9.2",
3
+ "version": "8.9.4",
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-stable4l-dateslice-noemoji",
28
+ "version": "3.0.0-stable4n-syntaxfix",
29
29
  "minver": "4.7.1"
30
30
  }
@@ -139,34 +139,7 @@ function updateTotalPrice() {
139
139
  selectMirror: true,
140
140
  dayMaxEventRows: true,
141
141
  displayEventTime: false,
142
- eventDisplay: 'block',
143
- eventContent: function(arg) {
144
- try {
145
- var status = (arg.event.extendedProps && arg.event.extendedProps.status) ? arg.event.extendedProps.status : '';
146
- var iconClass = '';
147
- if (status === 'pending') iconClass = 'fa fa-hourglass-half text-warning';
148
- else if (status === 'paid') iconClass = 'fa fa-check-circle text-success';
149
- else if (status === 'approved') iconClass = 'fa fa-check text-success';
150
- else if (status === 'rejected' || status === 'cancelled') iconClass = 'fa fa-times text-danger';
151
-
152
- var wrap = document.createElement('div');
153
- wrap.className = 'ec-event';
154
- if (iconClass) {
155
- var icon = document.createElement('span');
156
- icon.className = 'ec-icon';
157
- icon.innerHTML = '<i class="' + iconClass + '"></i>';
158
- wrap.appendChild(icon);
159
- }
160
- var t = document.createElement('span');
161
- t.className = 'ec-title';
162
- t.textContent = arg.event.title || '';
163
- wrap.appendChild(t);
164
- return { domNodes: [wrap] };
165
- } catch (e) {
166
- return true;
167
- }
168
- },
169
- timeZone: 'local',
142
+ timeZone: 'local',
170
143
  events: events,
171
144
  select: function (info) {
172
145
  if (!window.EC_CAN_CREATE) return;
@@ -36,7 +36,7 @@
36
36
  </form>
37
37
 
38
38
  <div class="text-muted small mb-2">
39
- Total (filtré) : <strong>{total}</strong> Total (global) : <strong>{totalAll}</strong>
39
+ Total (filtré) : <strong>{total}</strong> - Total (global) : <strong>{totalAll}</strong>
40
40
  </div>
41
41
 
42
42
  {{{ if hasRows }}}
@@ -59,7 +59,7 @@
59
59
  <div id="ec-total-days">1 jour</div>
60
60
  <hr class="my-2">
61
61
  <div class="fw-semibold">Total estimé</div>
62
- <div id="ec-total-price" class="fs-5">0 €</div>
62
+ <div id="ec-total-price" class="fs-5">0 EUR</div>
63
63
  </div>
64
64
  </div>
65
65