Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Range picker should emit event on first selected date #429

Closed
colq2 opened this issue Feb 26, 2020 · 4 comments
Closed
Labels

Comments

@colq2
Copy link

colq2 commented Feb 26, 2020

What problem does this feature solve?

It is not possible to listen to the select event which is emitted by CalendarPanel in CalendarRange. It would be awesome to get this possibility.

Use case

For example we have a range picker, but it is possible to have a same-day range. A UX would be if the user could only pick once and we can add a computed property for the end date. Which would be by default the same date as the start date.

What does the proposed API look like?

  1. Approach
    Also emit the input event on the first date pick with [start_date, null]

  2. Approach
    Emit the select event delegated from CalendarPanel to DatePicker

Thank you for your great work!

@colq2
Copy link
Author

colq2 commented Feb 26, 2020

Same as #428

@mengxiong10
Copy link
Owner

Yes, I'll add the feature in next version.

@mengxiong10
Copy link
Owner

mengxiong10 commented Mar 3, 2020

It'll emit a pick event when the date is selected .

<date-picker
  v-model="value"
  range
  placeholder="Select date range"
  @pick="handlePick"
></date-picker>
methods: {
  handlePick(date) {
    this.value = [date, new Date(date.getTime() + 30 * 24 * 3600 * 1000)]
 },
},

@mengxiong10
Copy link
Owner

v3.4.0 added it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants