bank20baht-validator 0.3.2 → 0.3.3

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 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -94,8 +94,10 @@ function typeIssue(field, value) {
94
94
  return typeof value === 'string' ? null : t('pattern');
95
95
  case 'date': {
96
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;
97
+ // day. `enable_time` also accepts an ISO local datetime (what the
98
+ // picker actually emits) - a bare day is still fine on that field too,
99
+ // for callers that only ever cared about the date part.
100
+ const isDay = (v) => parseIsoDate(v) !== null || (field.enable_time && parseIsoDateTime(v) !== null);
99
101
  switch (field.date_mode ?? 'single') {
100
102
  case 'range':
101
103
  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.2",
3
+ "version": "0.3.3",
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",