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

How can i select single date #34

Open iLojan opened 3 years ago

iLojan commented 3 years ago

is there are any way to select a single date in double date-picker view

zeyadsharo commented 3 years ago

@iLojan here is an example

<template>
  <div>
    <litepie-datepicker
        ref="myRef"
        as-single
        :formatter="formatter"
        v-model="dateValue"
    />
  </div>
</template>

<script>
import { ref } from 'vue';
import LitepieDatepicker from 'litepie-datepicker';

export default {
  components: {
    LitepieDatepicker
  },
  setup() {

    let today=new Date().toISOString().slice(0,10)
    const myRef = ref(today);
    const dateValue = ref([]);
    const formatter = ref({
      date: 'DD MM YYYY',
      month: 'MM'
    });

    return {
      myRef,
      dateValue,
      formatter
    };
  }
};
</script>