question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nb-datepicker with NbMomentDateModule not working

See original GitHub issue

Issue type

I’m submitting a … (check one with “x”)

  • bug report
  • feature request

Issue description

nb-datepicker with NbMomentDateModule not working Current behavior:

I added nb-datepicker to the html page and also added NbMomentDateModule but when the page loads , I get an exception in the console.

<input class=“form-control” nbInput placeholder=“Birth Date” [nbDatepicker]=“formcontrol” formControlName=“birthDate”> <nb-datepicker #formcontrol></nb-datepicker>

Exception: ERROR TypeError: date.format is not a function at NbMomentDateService.format (moment-date.service.js?7128:54) at NbDateAdapterService.format (datepicker-adapter.js?5298:32) at NbDatepickerDirective.writeInput (datepicker.directive.js?0efc:349) at NbDatepickerDirective.writeValue (datepicker.directive.js?0efc:207) at setUpControl (forms.js?8087:1645) at FormGroupDirective.addControl (forms.js?8087:4454)

Expected behavior:

The datepicker should be initialized with moment() and value should be set when a date is selected Steps to reproduce:

  1. Add nb-datepicker with NbMomentDateModule
  2. launch browser and view console
  3. Select a date and retrieve the value in your component class

Related code:

insert short code snippets here

Other information:

npm, node, OS, Browser

<!--
Node, npm: `node --version` and `npm --version`
OS: Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)
Browser: Chrome/Safari/Firefox/etc?
-->

Angular, Nebular

<!--
Check your `package-lock.json` or locate a `package.json` in the `node_modules` folder.
-->

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
Dalejancommented, Jan 6, 2019

I quit nebular, now i’m using another framework. Nebular is good but these kind of issues were very important to my project.

El dom., 6 de ene. de 2019 a la(s) 11:31, Ganapathy Mano ( notifications@github.com) escribió:

Hi DanishFayaz, I am also facing the same issue, are you able to solve it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/akveo/nebular/issues/926#issuecomment-451755013, or mute the thread https://github.com/notifications/unsubscribe-auth/ATJZK2P6bdOz7tedhZwZ6n4r7GdZhQ9oks5vAiTxgaJpZM4XywfU .

3reactions
DanishFayazcommented, Dec 8, 2018

ERROR TypeError: date.getFullYear is not a function Im gettin this error when add format=“MM/dd/yy” in nb-datepicker component

Same Issue. When I set my form fields and click for the calendar to open. I get the same error in the console and all the dates on the calendar are gone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 9 and ngx-admin nb Date picker invalid despite good ...
According to Formatting Issue and Nebular section probably you forgot to import NbDateFnsDateModule or NbMomentDateModule.
Read more >
Nebular - Datepicker Angular UI Component - GitHub Pages
Customizable Angular UI Library based on Eva Design System with 40+ UI components, 4 visual themes, Auth and Security modules.
Read more >
UNPKG - @nebular/theme
46, * It has to be bound to the datepicker directive through nbDatepicker input. ... 158, * import `NbMomentDateModule` from this package.
Read more >
Date Picker format to MM-DD-YYYY not working - OutSystems
Good day everyone! I have a problem in formatting a date using an input widget and a date picker. I try to set...
Read more >
InputEditDateFormat and/or DataPicker date format not working
Hi igrasso, Welcome to our forum and thanks for contacting us with your issue! In my case when I click at the date...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found