Angular2 Bootstrap Datepicker format date issue

569 views Asked by At

I have issue with overriding NgbDateParserFormatter I followed steps from this question but it doesn't work for me. Look like that app doesn't override original NgbDateParserFormatter.

My app structure looks like this:

|-app/
|--app.module.ts
|-- datepicker/
|---datepicker.component.ts
|---ngb-datepicker-parser-formatter.ts
|--login/
|---login.module.ts

I have imported ngb-datepicker-parser-formatter.ts in app.module and login.module. I am using datepicker.component in another component wich is lazy loaded with login.module. My app.module looks like this:

 @NgModule({
  ---
  imports: [
    ---
   NgbModule.forRoot(),
   ---
   ],
  providers: [
   ---,
   { 
     provide: 'NgbDateParserFormatter', 
     useFactory: () => { return new NgbDateMomentParserFormatter("DD-MM-YYYY")}
   }],
    ---
 })
0

There are 0 answers