nebular
nebular copied to clipboard
fix(nb-rangepicker): improve validators
Please read and mark the following check list before creating a pull request:
- [X] I read and followed the CONTRIBUTING.md guide.
- [X] I read and followed the New Feature Checklist guide.
Short description of what this resolves:
Fixes #2517
MinValidator and MaxValidator were thinking that value is a Date. Problem was that for rangePicker its an object with {start: Date, end: Date}. Modified validators to think about start and end values (P.S. if they exist)
I just faced a problem linked to this in one of our clients applications:
ERROR TypeError: Cannot read properties of undefined (reading 'match')
at parseNumericPattern (utils.mjs:20:34)
at parseNDigits (utils.mjs:71:14)
at DateParser.parse (DateParser.mjs:26:28)
at DateParser.run (Parser.mjs:5:25)
at parse (parse.mjs:426:34)
at NbDateFnsDateService.parse (nebular-date-fns.mjs:25:21)
at NbRangeAdapterService.parse (nebular-theme.mjs:24962:35)
at NbDatepickerDirective.minValidator (nebular-theme.mjs:7890:45)
at forms.mjs:790:40
at Array.map (<anonymous>)
The problem occurs when we are using a RangePicker with a Reactive Form. This PR seems to be related to the problem. What are the chances that this will get merged into ne next release?