tpmkms_4wp 9.3.0-beta.8 → 9.3.0-beta.9

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.
@@ -0,0 +1,48 @@
1
+ const pluralize = require('pluralize')
2
+ const deepEqual = require('deep-equal')
3
+ const { chooseNumber, zip } = require('../helpers.js')
4
+ const { compose, translationMapping, translationMappingToInstantiatorMappings } = require('./meta.js')
5
+
6
+ function getNextDayOfWeek(date, targetDay) {
7
+ const dayMap = {
8
+ 'sunday_dates': 0,
9
+ 'monday_dates': 1,
10
+ 'tuesday_dates': 2,
11
+ 'wednesday_dates': 3,
12
+ 'thursday_dates': 4,
13
+ 'friday_dates': 5,
14
+ 'saturday_dates': 6
15
+ };
16
+
17
+ const targetDayNum = dayMap[targetDay.toLowerCase()]
18
+ if (!targetDayNum) {
19
+ return
20
+ }
21
+ const currentDay = date.getDay();
22
+
23
+ let daysUntilNext = targetDayNum - currentDay;
24
+ if (daysUntilNext <= 0) {
25
+ daysUntilNext += 7; // If target day is today or past, get next week's occurrence
26
+ }
27
+
28
+ const nextDate = new Date(date);
29
+ nextDate.setDate(date.getDate() + daysUntilNext);
30
+ return nextDate;
31
+ }
32
+
33
+ instantiate = (now, context) => {
34
+ if (context.date) {
35
+ const date = getNextDayOfWeek(now, context.date?.date?.value)
36
+ if (date) {
37
+ return date.toISOString()
38
+ }
39
+ }
40
+ }
41
+
42
+ until = (time) => {
43
+ }
44
+
45
+ module.exports = {
46
+ instantiate,
47
+ until,
48
+ }
package/package.json CHANGED
@@ -216,7 +216,7 @@
216
216
  "common/helpers/meta.js",
217
217
  "common/helpers/ordering.js",
218
218
  "common/helpers/properties.js",
219
- "common/helpers/properties.js",
219
+ "common/helpers/reminders.js",
220
220
  "common/hierarchy.js",
221
221
  "common/hierarchy.test.json",
222
222
  "common/javascript.js",
@@ -337,8 +337,8 @@
337
337
  "scriptjs": "^2.5.9",
338
338
  "table": "^6.7.1",
339
339
  "uuid": "^9.0.0",
340
- "theprogrammablemind_4wp": "9.3.0-beta.8"
340
+ "theprogrammablemind_4wp": "9.3.0-beta.9"
341
341
  },
342
- "version": "9.3.0-beta.8",
342
+ "version": "9.3.0-beta.9",
343
343
  "license": "UNLICENSED"
344
344
  }