mathieustan / vue-datepicker

A clean datepicker made with VueJs

Home Page:https://vue-datepicker.netlify.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid Year

ecarrera opened this issue · comments

Hi @mathieustan, I'm currently in Chile (GMT-3) and I think that the GMT difference is giving me a bad format conversion for the year.

I took, by example a year and the shown year is 1 less than the chosen.

This is the implementation:

<vue-date-picker
  v-model="fieldData.value"
  v-bind="fieldData.settings"
  :name="fieldData.label"
  :type="fieldData.fieldType"
  :fullscreen-mobile="true">
  <template #activator="{date}">
    <button
      :id="key"
      :name="fieldData.label"
      :placeholder="fieldData.placeholder"
      class="form-control form-control-lg d-flex justify-content-between align-items-center">
      {{ date ? date : '&zwnj;' }}
      <font-awesome-icon
        icon="calendar"
        class="text-muted"
        size="sm" />
    </button>
  </template>
</vue-date-picker>

If I don't use a template the year is fine, but, once the calendar is opened again the selected year on the calendar is 1 year less than the real selection.

Can it be a bug? Am I doing something wrong? Or there is a way to avoid GMT conversions?

Greets.

Hello @ecarrera.

I tried different things, and it seems to work for me. Can you give me a reproduction link ?

ezgif-4-4f06c7db4f5b

https://codesandbox.io/s/peaceful-nobel-cssqq?file=/src/App.vue

@mathieustan look that the year from the #activator is not the picked year, but the value, is OK. The other thing is the shown year in the calendar.

Thank you 👍 I’ll fix this asap.

@ecarrera Could you test this new version ?

Fixed in v0.2.5