Ngx-bootstrap: Issue with Datepicker when using optimized Builds

Created on 19 Nov 2018  路  16Comments  路  Source: valor-software/ngx-bootstrap

Bug description or feature request:

Compiling an application with "ng build --progress=false --prod"

This causes issues on the datepicker and BsDatePicker. All days / month / years are replaced with
"DD", "MM", "YYYY".

--prod enables the "buildOptimizer" flag.

I guess this will will cause some issues in the dependency injection.

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 3.1.1

-> It worked with "ngx-bootstrap": "^3.0.1",

Angular: 6.x

Bootstrap: 4.x

Build system: Angular CLI, System.js, webpack, starter seed:

6.x

Most helpful comment

Any information regarding this? Datepicker is currently unusable.

All 16 comments

Same issue for me.

xref #4752, #4754

Thank you. Any release date scheduled for 3.1.2?

Same issue here. I've downgraded to 3.0.1 until this is fixed. There's something important between 3.0.1 and 3.1.1?

@egandro 3.1.2 with the fix released, please try

It's working for me. Thanks

Thank you.

It seems like this returned in 3.2.0, even for a build that is not optimized (Bootstrap 4.2, NG CLI 7.2.2, Angular 7.2.1).

@sebastian-zarzycki-es
Does not reproduced on 3.2.0
(Angular: 7.2.1, Bootstrap 4.2, CLI 6.1.5)

Angular CLI: 7.2.2
Node: 10.6.0
OS: darwin x64
Angular: 7.2.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.12.2
@angular-devkit/build-angular     0.12.2
@angular-devkit/build-optimizer   0.12.2
@angular-devkit/build-webpack     0.12.2
@angular-devkit/core              7.2.2
@angular-devkit/schematics        7.2.2
@angular/cli                      7.2.2
@ngtools/webpack                  7.2.2
@schematics/angular               7.2.2
@schematics/update                0.12.2
rxjs                              6.3.3
typescript                        3.2.2
webpack                           4.28.4
  "bootstrap": "^4.2.1",
   (...)
   "ngx-bootstrap": "^3.2.0",

screenshot 2019-01-22 at 15 27 28

This is standard ng serve, not a prod build with optimizations turned on.

Any information regarding this? Datepicker is currently unusable.

Also tested with CLI 7.3.0. Same issue.

@sebastian-zarzycki-es check your tsconfig.json file. under compiler options see if your "target" is set to "es6". I found that bs datepicker did not load locales' properly for me unless it was set to "es5"

Yes. it's on "es5". I've tested this on a fresh angular project.

@sebastian-zarzycki-es
Sorry, I was loaded with the higher priority task.
Please create a repo with reproduction, I'll take a look

I've found the culprit in the meantime.

I've been using:

    defineLocale('en', locale);
    this.localeService.use('en');

What seems to yield correct results is:

    defineLocale('en-gb', locale);
    this.localeService.use('en-gb');

Your locale documentation seems to suggest that using 'en' this way is ok, too. It isn't (there's no "en" locale file in chronos).

Was this page helpful?
0 / 5 - 0 ratings