Nebular: nb-datepicker reactive form failed validation

Created on 26 Oct 2018  Â·  9Comments  Â·  Source: akveo/nebular

Issue type

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

  • [X ] bug report
  • [ ] feature request

Issue description

Current behavior:

With the format of "dd/MM/yyyy", selecting any date above 13th i.e.13th Dec 2018 returns reactive form validation errors.
log showing FormControl.errors: {nbDatepickerParse: {value: "13/12/2018"}}

Expected behavior:
log should have errors of null. FormControl.errors: null

Steps to reproduce:

pick any date above 12th of the month

Related code:

Other information:

npm, node, OS, Browser
npm v6.4.1

Angular, Nebular
"@angular/common": "6.0.0",
"@nebular/auth": "2.0.1",
"@nebular/bootstrap": "2.0.1",
"@nebular/security": "2.0.1",
"@nebular/theme": "2.0.1",

urgent bug theme needs info

All 9 comments

Hi @hftey! Do you use date adapters (@nebular/moment or @nebular/date-fns)?
If no, you can't use format, since native Date doesn't have format method. See Formatting Issue note in the docs.

To use format input, you need to install date adapter and import its module in the app module.
Example with date-fns:

  1. First npm i @nebular/date-fns.
  2. Add NbDateFnsDateModule to app module:
import { NbDateFnsDateModule } from '@nebular/date-fns';

@NgModule({
  imports: [ NbDateFnsDateModule ],
})
export class AppModule {}

I have the same issue, and I followed the procedure of date-fns, I installed all dependencies and add the NbDateFnsDateModule to App Module. once I build the program, it is say: "Can't resolve 'date-fns/parse".
Any idea or suggestion to fix this problems?

@PrometheusPolis check in your node_modules folder in date-fns package exist, if it doesn't you need to runnpm i date-fns

After installing date-fns
./node_modules/@nebular/date-fns/services/date-fns-date.service.js
Module not found: Error: Can't resolve 'date-fns/format in node_modules\@nebulardate-fns\services'

Hi yggg,

I followed all process and date-fns and moment available in node-modules.
But when we select any date except 11th, it's show invalid.
Please suggest,

@RoukayaBechri - use this cmd for module not found - npm install date-fns --save

After installing date-fns
./node_modules/@nebular/date-fns/services/date-fns-date.service.js
Module not found: Error: Can't resolve 'date-fns/format in node_modules@nebulardate-fns\services'

Hi,
I have also such error
ERROR in ./node_modules/@nebular/date-fns/fesm2015/index.js
Module not found: Error: Can't resolve 'date-fns/getWeek' in

both dependencies must be installed to resolve the error
npm i @nebular/date-fns date-fns

Hi yggg,

I followed all process and date-fns and moment available in node-modules.
But when we select any date except 11th, it's show invalid.
Please suggest,

@RoukayaBechri - use this cmd for module not found - npm install date-fns --save

I have the same issue! Does anyone have an explanation to this!!

Hi,

If you have installed nb-datepicker then give the path. It's module path
issue.
Ng serve facing the path issue of this module.

Nb-datepicker path should use in module.ts

Still facing problem then share screen-shot and steps.

Regards,
Kanhaiya

On Mon, Jan 6, 2020, 18:00 AmruthaSushant notifications@github.com wrote:

After installing date-fns
./node_modules/@nebular/date-fns/services/date-fns-date.service.js
Module not found: Error: Can't resolve 'date-fns/format in
node_modules@nebulardate-fns\services'

Hi,
I have also such error
ERROR in ./node_modules/@nebular/date-fns/fesm2015/index.js
Module not found: Error: Can't resolve 'date-fns/getWeek' in
'C:\Users\91994\Documents\Amrutha\GitLab\flycon-classicnode_modules@nebular
date-fns\fesm2015'

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/akveo/nebular/issues/946?email_source=notifications&email_token=ANQ3DQMV6ZG6JVV2LNYZN3LQ4MP5FA5CNFSM4F7PZTLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIFJ5VQ#issuecomment-571121366,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ANQ3DQLCYZP47FNYIP4IP2DQ4MP5FANCNFSM4F7PZTLA
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mmezian picture mmezian  Â·  3Comments

maihannijat picture maihannijat  Â·  3Comments

andredatsch picture andredatsch  Â·  3Comments

NikhilGangurde picture NikhilGangurde  Â·  3Comments

bnbs picture bnbs  Â·  4Comments