Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change locale with BsDatepicker #2842

Closed
aurerua opened this issue Oct 13, 2017 · 2 comments · Fixed by #2879
Closed

Cannot change locale with BsDatepicker #2842

aurerua opened this issue Oct 13, 2017 · 2 comments · Fixed by #2879

Comments

@aurerua
Copy link

aurerua commented Oct 13, 2017

Trying to use another locale for the new datepicker as described in the docs, this error gets thrown:

(SystemJS) Cannot set property 'abbr' of undefined

The error comes out of defineLocale('de', de); added to the module. The locale object de is undefined when his abbr attribute is set...

The issue remains if the import statement is changed from

import { de } from 'ngx-bootstrap/locale';

to

import { de } from 'ngx-bootstrap';

(And the editor complains that ngx-bootstrap/index has no exported member 'de'.)

Config:

  • ngx-bootstrap@2.0.0-beta.6
  • Angular 4 (Angular Seed - megchev)
  • Bootstrap 3.3.7
@aurerua
Copy link
Author

aurerua commented Oct 13, 2017

Here is a temporary fix, that works for me:

  • Copy file bs-moment/i18n/de.ts (found under /src/ on GitHub or node_modules/ngx-bootstrap locally) to your angular app
  • import it from there. So, in the module, instead of import { de } from 'ngx-bootstrap/locale'; do import { de } from 'path/to/local/flie/de.ts';

@IlyaSurmay
Copy link
Contributor

The issue here is that ngx-bootstrap/index doesn't export any locales, they're all exported from ngx-bootstrap/locale but SystemJS can't handle this path, so we'll need to additionally export locales in ngx-bootstrap/index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants