akveo / nebular

:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/nebular
MIT License
8.05k stars 1.51k forks source link

nb-datepicker with NbMomentDateModule not working #925

Closed tcbuzor closed 5 years ago

tcbuzor commented 5 years ago

Issue type

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

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>

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.
-->
tcbuzor commented 5 years ago

closing duplicate issue