nodebb-plugin-equipment-calendar 8.9.3 → 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.
Files changed (3) hide show
  1. package/library.js +12 -10
  2. package/package.json +1 -1
  3. package/plugin.json +1 -1
package/library.js CHANGED
@@ -1328,25 +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 || 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;
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
1336
  if (!/^\d{4}-\d{2}-\d{2}$/.test(_startIso)) {
1337
1337
  const ms = Number(req.body.startMs || req.body.startTime || 0);
1338
- if (ms) _startIso = new Date(ms).toISOString().slice(0,10);
1338
+ if (ms) _startIso = new Date(ms).toISOString().slice(0, 10);
1339
1339
  }
1340
1340
  if (!/^\d{4}-\d{2}-\d{2}$/.test(_endIso)) {
1341
1341
  const ms = Number(req.body.endMs || req.body.endTime || 0);
1342
- if (ms) _endIso = new Date(ms).toISOString().slice(0,10);
1342
+ if (ms) _endIso = new Date(ms).toISOString().slice(0, 10);
1343
1343
  }
1344
+
1344
1345
  if (!/^\d{4}-\d{2}-\d{2}$/.test(_startIso) || !/^\d{4}-\d{2}-\d{2}$/.test(_endIso)) {
1345
1346
  return res.status(400).send('dates required');
1346
1347
  }
1347
1348
 
1348
1349
  const startMs = Date.parse(_startIso + 'T00:00:00Z');
1349
- const endMs = Date.parse(addDaysIso(__endIso: _endIso, 1) + 'T00:00:00Z'); // exclusive end
1350
+ const endMs = Date.parse(addDaysIso(_endIso, 1) + 'T00:00:00Z'); // exclusive end
1350
1351
  if (!startMs || !endMs || endMs <= startMs) {
1351
1352
  return res.status(400).send('dates required');
1352
1353
  }
@@ -1374,8 +1375,8 @@ async function handleCreateReservation(req, res) {
1374
1375
  itemId,
1375
1376
  startMs,
1376
1377
  endMs,
1377
- _startIso: _startIso,
1378
- _endIso: _endIso,
1378
+ startIso: _startIso,
1379
+ endIso: _endIso,
1379
1380
  days,
1380
1381
  unitPrice,
1381
1382
  total,
@@ -1395,6 +1396,7 @@ async function handleCreateReservation(req, res) {
1395
1396
  }
1396
1397
 
1397
1398
 
1399
+
1398
1400
  async function handleApproveReservation(req, res) {
1399
1401
  try {
1400
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.3",
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-stable4m-ascii-dates",
28
+ "version": "3.0.0-stable4n-syntaxfix",
29
29
  "minver": "4.7.1"
30
30
  }