nebular icon indicating copy to clipboard operation
nebular copied to clipboard

nb-datepicker with [min] and not required throwing validation error when cleared

Open troddick opened this issue 3 years ago • 2 comments

Issue type

I'm submitting a ... (check one with "x")

  • [x] bug report
  • [ ] feature request

Issue description

Current behavior: Setting a [min] date for the nb-datepicker on a reactive form control that is not required. Setting the date, and then clearing the date causes the form validation to be invalid with { errors: { nbDatepickerMin: { actual: Invalid Date {}, min: Fri Jan 01 2021 00:00:00 } } }

Expected behavior: Clearing the date should set the value to empty string or null (I've tried both) and still be valid upon submit.

Steps to reproduce: Set the date. Then clear the date. the form control is now invalid

Related code: https://stackblitz.com/edit/github-jt9t8j?file=src%2Fapp%2Fapp.component.html (https://github-jt9t8j.stackblitz.io)

Other information:

npm, node, OS, Browser Node: 10.14.0 OS: Windows 10 Browser: Chrome

Angular, Nebular @nebular/theme: "^6.2.1" angular: 10.2.1

troddick avatar May 20 '21 16:05 troddick

+1

Ki-csen avatar Jan 03 '22 11:01 Ki-csen

Any update with this issue ?

Looks like the PR https://github.com/akveo/nebular/pull/2822 hasn't been merged

laouenanlc avatar Jun 08 '23 09:06 laouenanlc