Ngx-bootstrap: Datepicker not showing days nor months on `ng build` but OK on `ng serve`

Created on 30 Oct 2018  ·  11Comments  ·  Source: valor-software/ngx-bootstrap

Bug description or feature request: bug description

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 3.1.1
Angular: 6.1.10 / 7.0.1
Bootstrap: 3.3.7

Build system: Angular CLI

Hello,

Since v3.1.1 the datepicker does not seem to work anymore (see attached screenshot) when building our app.
Our app is in French so we are using defineLocale to set the lang.
What I tested:

  • using ng serve it works great ✔
  • using ng build --prod it produces what you can see on the screenshot ❌

Please feel free to ask for more I'd be happy to help.

capture d ecran de 2018-10-30 11-33-22

angular issue

Most helpful comment

It looks to me, that the problem is actually in the code of ngx-bootstrap, rather than in Angular CLI.

All 11 comments

@bravier please provide a code of reproduction for this issue.

Thanks for your comment @Domainv.

Unfortunately I can't give you a code that reproduces the issue.
Instead what I can do is to show you how we are using the datepicker.

Here are the involved parts:

_date-chooser.component.ts_

...
import {defineLocale} from 'ngx-bootstrap/chronos';
import {frLocale} from 'ngx-bootstrap/locale';
...

@Component({
  selector: 'date-chooser',
  templateUrl: './date-chooser.component.html',
    ...
  }],
})
export class DateChooserComponent {
   constructor() {
    defineLocale('fr', frLocale);
    // We also tried using the following (saw in the docs) without success:
    // this.bsLocaleService.use('fr');
  }           
}

_date-chooser.component.html_

<p bsDatepicker [bsConfig]='{dateInputFormat: "DD/MM/YYYY", locale: "fr"}' [bsValue]='date'>{{ date | date:'dd/MM/y' }}</p>

Hope this helps!

I am also facing this same problem, I am on 'en' locale though
screen shot 2018-10-31 at 9 02 19 am

I don't know If this might help you guys, but I downgraded to 3.0.0 and it's working fine. I suggest downgrading for a while till they fix this problem 👍

Absolutely @rabingaire20 we also fixed it by downgrading to 3.0.1.

@bravier This issue related to https://github.com/angular/angular-cli/issues/12112
just set "buildOptimizer": false

@Domainv You save my day 👍

It looks to me, that the problem is actually in the code of ngx-bootstrap, rather than in Angular CLI.

Setting the buildOptimizer to false for a single package is not the way to go. This seems like a library issue with ngx-bootstrap.

closes as duplicate of #4752

@here The issue fixed from 3.1.2 version

Was this page helpful?
0 / 5 - 0 ratings