Ngx-bootstrap: Datepicker : Initial value doesn't take locale format into account

Created on 7 Nov 2017  路  16Comments  路  Source: valor-software/ngx-bootstrap

Bug description or feature request:

When settings the initial value of a datepicker through ngModel, the set format seems to be ignored.
Format is used when selecting a new value.

Plunker/StackBlitz that reproduces the issue:

https://stackblitz.com/edit/ngx-bootstrap-datepicker-tpmm9q
I set in app.module the local to 'fr'. But the initial value seems to be format 'en' and it switch to 'fr' when selecting a new value.

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 2.0.0-beta.8
Angular: 4.3.6
Bootstrap: 3.3.7

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

Angular CLI

comp(datepicker) issue medium

Most helpful comment

@valorkin I notice this issue is closed, but we are still running into issues with the date format. Should we create a new issue?

All 16 comments

Any updates?

Just stupid q:
Why you are working on an <input> instead of <bs-datepicker>? At least with this tag I experience no problems

@leomayer Because all of the examples in the docs use

working on extracting date adapter, it will cover current use case

Any update about this issue? It happens also on 'it' locale.
Initially it shows the correct locale but when i write for example 1/12/2017 (1st of December in Italian locale) it becomes 12/1/2017 (12th of January in Italian locale).

Looks like this has been fixed in version 2.0.0-beta9. Thank you so much

Initial value is fixed,
When you manually enter - not for all locales

fix this please :'(

fix this please :'(

In my case it's fixed since beta.9.
Thank you guys ^^

Manual input parse will be merged next week

it work's with the beta.9
but it's not work's with the rc.0

This issue can be reproduced with the 2.0.2 release. Any chance this is going to be fixed soon ?

I have the same issue with 2.0.3. Trying to use en-gb (DD/MM/YYYY) format and initial value is in MM/DD/YYYY format. After selecting date in datepicker, I get correct format. Also, if I change date manually and open picker again I get the correct format. Only the first displayed format is wrong.

Just to add to my last post - I managed to get correct initial format by using BsLocaleService and in my constructor I called service.use('en-gb').

I have the same problem. Any updates?

My initial value is in MM/DD/YYYY instead DD/MM/YYYY.

@valorkin I notice this issue is closed, but we are still running into issues with the date format. Should we create a new issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Scooviese picture Scooviese  路  3Comments

ravirajhalli picture ravirajhalli  路  3Comments

MrBlaise picture MrBlaise  路  3Comments

tuoitrexuquang picture tuoitrexuquang  路  3Comments

haisaco picture haisaco  路  3Comments