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

AutoApply on customShortcuts #8

Closed tbordinat closed 3 years ago

tbordinat commented 3 years ago

On mobile, when using customShortcuts, it's impossible to apply changes when autoApply is set to false.

image

It could be great to set dates directly and submitting it.

Here is the code of my shortcuts, maybe I missed something :


      return [
        {
          label: '7 derniers jours',
          atClick: () => {
            const date = new Date()
            return [
              new Date(date.setDate(date.getDate() - 7)),
              new Date(),
            ]
          },
        },
// ...
kenhyuwa commented 3 years ago

I have try, and work with auto-apply is false

Screen Shot 2021-03-18 at 18 08 13

this my code

<litepie-datepicker
  :formatter="formatter"
  :auto-apply="false"
  :shortcuts="shortcuts"
  v-model="dateValue"
>
</litepie-datepicker>
tbordinat commented 3 years ago

My bad, the problem occurs when it's set to true (default value in my case).

When I click on "7 derniers jours", it's impossible to submit the new period, I can just cancel, or choose dates on the calendar.

kenhyuwa commented 3 years ago

when auto-apply is true, if you click shortcut, v-model has updated with your selection. you can changing button cancel with new props footer, read here. Thank you

kenhyuwa commented 3 years ago

I'll close this issue. Please open new issues if any related issues.

tbordinat commented 3 years ago

With this fix in 1.0.9, it's ok !

Fix bug auto-apply if shortcuts clicked.