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

No option for previous year? #28

Open Ahnaf opened 3 years ago

Ahnaf commented 3 years ago

In live demo I did not find option for previous year, for example, to input Date of Birth.

muarachmann commented 3 years ago

In live demo I did not find option for previous year, for example, to input Date of Birth.

If you are talking about navigating to previous years, see this https://vue-tailwind-picker.netlify.app/options/#star-date To determine the start date, the previous date will be disabled

kafk3d commented 3 years ago

Well, how to enable navigation to previous dates? Also, is there some guide how to change translate/local/lang?

kafk3d commented 3 years ago

Okay, I found a solution, Import picker directly to project resources and make some changes in core To enable previous date set startDate:

import VueDatePicker from './vue-tailwind-picker'
    export default {
        components: {
            VueDatePicker
        },
        data(){
            return {
                startDate: '2019-01-01',
                checkin: '',
            }
        }
    }

Then look into core mounted() hook (vue-tailwind-picker.vue) and add few lines to set current date to now:

mounted() {
            if (this.init) this.emit();
            this.changePicker(dayjs(new Date()));
            this.showPicker = !this.showPicker
        },

To change locale go to vue-tailwind-picker.vue and add this lines:

import * as locale from 'dayjs/locale/ru'
dayjs.locale(locale)

I'm not sure if it is professional solving, but it works