@object-ui/core 5.4.1 → 6.0.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @object-ui/core
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/types@6.0.0
8
+
9
+ ## 5.4.2
10
+
11
+ ### Patch Changes
12
+
13
+ - @object-ui/types@5.4.2
14
+
3
15
  ## 5.4.1
4
16
 
5
17
  ### Patch Changes
@@ -27,10 +27,17 @@
27
27
  * - next_week_start / next_month_start / next_quarter_start / next_year_start
28
28
  *
29
29
  * Parameterised tokens (match `N` as any positive integer):
30
- * - {N_days_ago} / {N_days_from_now}
31
- * - {N_weeks_ago} / {N_weeks_from_now}
32
- * - {N_months_ago} / {N_months_from_now}
33
- * - {N_years_ago} / {N_years_from_now}
30
+ * - {N_minutes_ago} / {N_minutes_from_now} (returns full ISO timestamp)
31
+ * - {N_hours_ago} / {N_hours_from_now} (returns full ISO timestamp)
32
+ * - {N_days_ago} / {N_days_from_now}
33
+ * - {N_weeks_ago} / {N_weeks_from_now}
34
+ * - {N_months_ago} / {N_months_from_now}
35
+ * - {N_years_ago} / {N_years_from_now}
36
+ *
37
+ * The canonical grammar is also published as part of the platform contract at
38
+ * `@objectstack/spec` → `DATE_MACRO_TOKENS` / `DATE_MACRO_PARAM_RE`. Keep this
39
+ * file in sync with the spec; the duplication is temporary until the next
40
+ * coordinated `@objectstack/spec` release.
34
41
  *
35
42
  * Walks any plain-object / array structure recursively. Non-string values
36
43
  * (and unknown tokens) are passed through untouched.
@@ -27,10 +27,17 @@
27
27
  * - next_week_start / next_month_start / next_quarter_start / next_year_start
28
28
  *
29
29
  * Parameterised tokens (match `N` as any positive integer):
30
- * - {N_days_ago} / {N_days_from_now}
31
- * - {N_weeks_ago} / {N_weeks_from_now}
32
- * - {N_months_ago} / {N_months_from_now}
33
- * - {N_years_ago} / {N_years_from_now}
30
+ * - {N_minutes_ago} / {N_minutes_from_now} (returns full ISO timestamp)
31
+ * - {N_hours_ago} / {N_hours_from_now} (returns full ISO timestamp)
32
+ * - {N_days_ago} / {N_days_from_now}
33
+ * - {N_weeks_ago} / {N_weeks_from_now}
34
+ * - {N_months_ago} / {N_months_from_now}
35
+ * - {N_years_ago} / {N_years_from_now}
36
+ *
37
+ * The canonical grammar is also published as part of the platform contract at
38
+ * `@objectstack/spec` → `DATE_MACRO_TOKENS` / `DATE_MACRO_PARAM_RE`. Keep this
39
+ * file in sync with the spec; the duplication is temporary until the next
40
+ * coordinated `@objectstack/spec` release.
34
41
  *
35
42
  * Walks any plain-object / array structure recursively. Non-string values
36
43
  * (and unknown tokens) are passed through untouched.
@@ -113,8 +120,8 @@ export function resolveDateMacros(filter, now = new Date()) {
113
120
  for (const [from, to] of Object.entries(aliases)) {
114
121
  macros[from] = macros[to];
115
122
  }
116
- // Parameterised tokens: {N_days_ago}, {N_weeks_from_now}, ...
117
- const paramRe = /^(\d+)_(days?|weeks?|months?|years?)_(ago|from_now)$/;
123
+ // Parameterised tokens: {N_days_ago}, {N_weeks_from_now}, {N_hours_ago}, ...
124
+ const paramRe = /^(\d+)_(minutes?|hours?|days?|weeks?|months?|years?)_(ago|from_now)$/;
118
125
  const resolveParam = (tok) => {
119
126
  const m = tok.match(paramRe);
120
127
  if (!m)
@@ -124,6 +131,12 @@ export function resolveDateMacros(filter, now = new Date()) {
124
131
  return null;
125
132
  const sign = m[3] === 'ago' ? -1 : 1;
126
133
  const unit = m[2].replace(/s$/, '');
134
+ if (unit === 'minute') {
135
+ return new Date(now.getTime() + sign * n * 60 * 1000).toISOString();
136
+ }
137
+ if (unit === 'hour') {
138
+ return new Date(now.getTime() + sign * n * 60 * 60 * 1000).toISOString();
139
+ }
127
140
  if (unit === 'day')
128
141
  return isoDate(addDays(now, sign * n));
129
142
  if (unit === 'week')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/core",
3
- "version": "5.4.1",
3
+ "version": "6.0.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "@objectstack/spec": "^5.2.0",
29
29
  "lodash": "^4.18.1",
30
30
  "zod": "^4.4.3",
31
- "@object-ui/types": "5.4.1"
31
+ "@object-ui/types": "6.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "typescript": "^6.0.3",