0

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 Answer 1

1

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"/>
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much (sorry for the late response). It works perfectly but is there any way to have the month in capital letters ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.