kenhyuwa / vue-tailwind-picker

:tada: Datepicker component for vue.js build with Tailwind CSS & dayjs date library
https://vue-tailwind-picker.netlify.app/
193 stars 38 forks source link

Fix format date #25

Closed 0s1r1s closed 3 years ago

0s1r1s commented 3 years ago

Problem

Because of the default value of the startDate prop it's not possible to use the formatDate prop without overriding the startDate every time.

startDate: {
      type: String,
      required: false,
      default: dayjs().format('YYYY-MM-DD'), // hardcoded format does not respect the formatDate prop
    },

Solution

I removed the default value which is using a hardcoded format and added a today fallback for the initialization of the startDatepicker variable instead.