bank20baht-validator 0.3.1 → 0.3.2

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 (2) hide show
  1. package/dist/index.js +4 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  // every value must have the shape the UI control could actually emit before
14
14
  // the authored validators run.
15
15
  // ---------------------------------------------------------------------------
16
- import { applyFlags, approvalFields, createScriptContext, defaultValue, evaluate, hasScripts, runScripts, getCatalog, parseDisabledEntry, parseIsoDate, resolveViewFields, setCatalog, setLocale, t, validateField, walkPath, normalizeLegacySchema, } from 'bank20baht-ui/engine';
16
+ import { applyFlags, approvalFields, createScriptContext, defaultValue, evaluate, hasScripts, runScripts, getCatalog, parseDisabledEntry, parseIsoDate, parseIsoDateTime, resolveViewFields, setCatalog, setLocale, t, validateField, walkPath, normalizeLegacySchema, } from 'bank20baht-ui/engine';
17
17
  /**
18
18
  * Run `fn` with the catalog switched to `locale`, restoring the previous
19
19
  * catalog after. The engine catalog is module-global; validation is fully
@@ -93,8 +93,9 @@ function typeIssue(field, value) {
93
93
  case 'password':
94
94
  return typeof value === 'string' ? null : t('pattern');
95
95
  case 'date': {
96
- // value shape follows date_mode; every day must be a real ISO calendar day
97
- const isDay = (v) => parseIsoDate(v) !== null;
96
+ // value shape follows date_mode; every entry must be a real ISO calendar
97
+ // day, or an ISO local datetime when the field carries `enable_time`
98
+ const isDay = (v) => field.enable_time ? parseIsoDateTime(v) !== null : parseIsoDate(v) !== null;
98
99
  switch (field.date_mode ?? 'single') {
99
100
  case 'range':
100
101
  return Array.isArray(value) && value.length === 2 && value.every(isDay)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bank20baht-validator",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "Runtime validation for bahtui form/workflow JSON — the exact engine rules the client runs, on the server.",
6
6
  "license": "MIT",