kenhyuwa / litepie-datepicker

Litepie Datepicker is a date range picker component for Vue.js and Tailwind CSS, dependent to day.js.
https://litepie.com
MIT License
373 stars 75 forks source link

startFrom is not honored when dateValue is passed #68

Open acidjazz opened 2 years ago

acidjazz commented 2 years ago

If I pass a dateValue of today, but make the start date last month, it ignores that.

Any way around this?

<template>
  <litepie-datepicker v-model="dateValue" :start-from="startFrom" :formatter="formatter" />
</template>

<script lang="ts" setup>
import LitepieDatepicker from 'litepie-datepicker'

const { $dayjs } = useNuxtApp()

const dateValue = ref([
  $dayjs().format('MM-DD-YYYY'),
  $dayjs().format('MM-DD-YYYY'),
])

const formatter = ref({
  date: 'MM-DD-YYYY',
  month: 'MMM',
})

const current = new Date()
const startFrom = ref(new Date(current.setMonth(current.getMonth()-1)))

</script>