0
votes

Good morning,

I have a problem with datepicker. I want the format "MM yyyy" to have something like "FEBRUARY 2016". The format works fine but when i click to choose my date, the value selected is always December of the selected year.

For exemple, today, we are in February, so, when i click on the field, it should select February month by default, but it selects December 2016. If i change the value to June 2017, then click on field to change again, the selected value by default is "December 2017", not June.

I don't understand why it does not select the good month :(

If i change the format to "MM yy" (FEBRUARY 16), it works, the value selected is the good one. Here is a picture explaining the problem:

enter image description here

Here is the HTML code :

<input id="testDate"
       class="wizard-field form-control"
       type="text"
       data-provide="datepicker"
       data-date-format="MM yyyy"
       data-date-start-view="year"
       data-date-min-view-mode="months"
       data-date-autoclose="true"
       value="FEBRUARY 2016"/>

Does someone have an idea why I have this problem? Am I doing something wrong?

Thank you for your help.

1

1 Answers

1
votes

Value should be "February 2016" instead of "FEBRUARY 2016".

Don't write FEBRUARY in capital.

<input id="testDate"
   class="wizard-field form-control"
   type="text"
   data-provide="datepicker"
   data-date-format="MM yyyy"
   data-date-start-view="year"
   data-date-min-view-mode="months"
   data-date-autoclose="true"
   value="February 2016"/>