Closed tobiaghiraldini closed 7 years ago
Getting the same behaviour, after switching the datepicker format via datePickerOptions.format
I got the same problem using the german locale. I just use language: "de"
and it correctly displays the date as dd.mm.yyyy, but querying the datepickers value using $("#id").datepicker("getUTCDate")
causes the datepicker to fall back to the american locale and it returns a wrong date where month and day are swapped.
I tried to build a minimal repro but was not successful so far.
I found a clue on what is going on here:
Short version: Remove the buttonClasses="fa fa-calendar"
and it should work.
Long version: When using the buttonClasses attribute the input element gets wrapped in a div and somehow the datepickers data attributes end up on the container div instead of the actual input. This causes the datepicker to miss the supplied options when calling getUTCDate
and therefore interpreting the date with the default format mm/dd/yyyy.
Any workaround to have both correct dates and "calendar button"?
As a workaround you can configure your field with your desired format in the schema and provide with a calendar field plugin directly in the html, using fontawesome for example. Following this route, you cannot use the quickfield template, but you’ll need to provide your own. You can contact me in case you’ll need more info.
Il giorno 20/gen/2016, alle ore 13:52, dw72 notifications@github.com ha scritto:
Any workaround to have both correct dates and "calendar button"?
— Reply to this email directly or view it on GitHub https://github.com/aldeed/meteor-autoform-bs-datepicker/issues/17#issuecomment-173195452.
Closing old issues. Can be reopened if it's still an issue in the latest release.
I am using aldeed:simple-schema and aldeed:autoform with aldeed:autoform-bs-datepicker. Setting the picker's format in the date field schema definition I am facing a strange behaviour when saving. The picker correctly fills the date in the field with the correct format ("dd/mm/yyyy)", but once I save the form, it switches the date to the other ("mm/dd/yyyy"). This makes the date to be saved in the wrong format. Here is my schema, and form field:
Schema
Form
Is there any other way to specify the date input format? Shouldn't this be enough for field format specifications?