nodebb-plugin-equipment-calendar 8.9.2 → 8.9.3

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
@@ -1329,14 +1329,24 @@ async function handleCreateReservation(req, res) {
1329
1329
  if (!itemIds.length) return res.status(400).send('itemIds required');
1330
1330
 
1331
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)) {
1332
+ const startIso = String(req.body.start || req.body.startDate || req.body.startIso || req.body.startStr || '').trim().slice(0,10);
1333
+ const endIso = String(req.body.end || req.body.endDate || req.body.endIso || req.body.endStr || '').trim().slice(0,10);
1334
+ let _startIso = startIso;
1335
+ let _endIso = endIso;
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
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(_startIso) || !/^\d{4}-\d{2}-\d{2}$/.test(_endIso)) {
1335
1345
  return res.status(400).send('dates required');
1336
1346
  }
1337
1347
 
1338
- const startMs = Date.parse(startIso + 'T00:00:00Z');
1339
- const endMs = Date.parse(addDaysIso(endIso, 1) + 'T00:00:00Z'); // exclusive end
1348
+ const startMs = Date.parse(_startIso + 'T00:00:00Z');
1349
+ const endMs = Date.parse(addDaysIso(__endIso: _endIso, 1) + 'T00:00:00Z'); // exclusive end
1340
1350
  if (!startMs || !endMs || endMs <= startMs) {
1341
1351
  return res.status(400).send('dates required');
1342
1352
  }
@@ -1364,8 +1374,8 @@ async function handleCreateReservation(req, res) {
1364
1374
  itemId,
1365
1375
  startMs,
1366
1376
  endMs,
1367
- startIso,
1368
- endIso,
1377
+ _startIso: _startIso,
1378
+ _endIso: _endIso,
1369
1379
  days,
1370
1380
  unitPrice,
1371
1381
  total,
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.3",
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-stable4m-ascii-dates",
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