@masterteam/components 0.0.193 → 0.0.194

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.
@@ -3013,6 +3013,9 @@ const CONDITION_WRAPPER_NAMES = new Set([
3013
3013
  'disable',
3014
3014
  ]);
3015
3015
  const PROPERTY_PREFIXES = ['@', '*.', '$.'];
3016
+ // Matches plain integers / decimals (optionally signed). Such values are
3017
+ // numbers, never dates — see `toDate`.
3018
+ const NUMERIC_STRING_PATTERN = /^[+-]?(\d+\.?\d*|\.\d+)$/;
3016
3019
  class FormulaParser {
3017
3020
  tokens;
3018
3021
  current = 0;
@@ -3613,8 +3616,19 @@ function toDate(value) {
3613
3616
  if (value instanceof Date) {
3614
3617
  return Number.isNaN(value.getTime()) ? null : value;
3615
3618
  }
3616
- if (typeof value === 'string' || typeof value === 'number') {
3617
- const date = new Date(value);
3619
+ // Plain numbers and numeric strings are NOT dates. `new Date('100')` parses
3620
+ // as the year 0100, which would otherwise hijack equality/ordering of a
3621
+ // numeric value (e.g. a percentage `== 100`) into a bogus date comparison.
3622
+ // Leave those to the numeric path.
3623
+ if (typeof value === 'number') {
3624
+ return null;
3625
+ }
3626
+ if (typeof value === 'string') {
3627
+ const trimmed = value.trim();
3628
+ if (trimmed === '' || NUMERIC_STRING_PATTERN.test(trimmed)) {
3629
+ return null;
3630
+ }
3631
+ const date = new Date(trimmed);
3618
3632
  return Number.isNaN(date.getTime()) ? null : date;
3619
3633
  }
3620
3634
  return null;