tpmkms_4wp 9.3.0-beta.45 → 9.3.0-beta.46

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.
@@ -86,17 +86,28 @@ function getTime(time) {
86
86
  }
87
87
 
88
88
  instantiate = (isA, now, context) => {
89
- debugger
90
- if (
91
- (context.marker == 'onDate_dates' && context.date?.marker == 'monthDayYear_dates') ||
92
- (context.marker == 'monthDayYear_dates')
93
- ) {
94
- if (context.marker == 'onDate_dates') {
95
- context = context.date
89
+ const getType = (context, type) => {
90
+ if (context.marker == 'onDate_dates' && context.date?.marker == type) {
91
+ return context.date
92
+ } if (context.marker == type) {
93
+ return context
96
94
  }
97
- const day = context.day.value;
98
- const month = toMonthNumber(context.month.value);
99
- const year = context.year.value;
95
+ }
96
+ let value
97
+ if (value = getType(context, 'monthDay_dates')) {
98
+ const day = value.day.value;
99
+ const month = toMonthNumber(value.month.value);
100
+ debugger
101
+ const currentMonth = now.getMonth() + 1; // 1-based (January = 1)
102
+ const currentYear = now.getFullYear();
103
+ const year = currentMonth >= month ? currentYear + 1 : currentYear;
104
+
105
+ const date = new Date(year, month-1, day)
106
+ return date.toISOString()
107
+ } else if (value = getType(context, 'monthDayYear_dates')) {
108
+ const day = value.day.value;
109
+ const month = toMonthNumber(value.month.value);
110
+ const year = value.year.value;
100
111
  const date = new Date(year, month-1, day)
101
112
  return date.toISOString()
102
113
  } else if (isA(context?.marker, 'dateTimeSelector')) {
package/package.json CHANGED
@@ -341,8 +341,8 @@
341
341
  "scriptjs": "^2.5.9",
342
342
  "table": "^6.7.1",
343
343
  "uuid": "^9.0.0",
344
- "theprogrammablemind_4wp": "9.3.0-beta.45"
344
+ "theprogrammablemind_4wp": "9.3.0-beta.46"
345
345
  },
346
- "version": "9.3.0-beta.45",
346
+ "version": "9.3.0-beta.46",
347
347
  "license": "UNLICENSED"
348
348
  }