nebular icon indicating copy to clipboard operation
nebular copied to clipboard

fix(nb-rangepicker): improve validators

Open chirichok98 opened this issue 4 years ago • 1 comments

Please read and mark the following check list before creating a pull request:

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)

chirichok98 avatar Aug 17 '21 17:08 chirichok98

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?

timoschlueter avatar Jan 10 '24 13:01 timoschlueter