Vue2-datepicker: [Feature request] Range picker should emit event on first selected date

Created on 26 Feb 2020  路  4Comments  路  Source: mengxiong10/vue2-datepicker

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!

feature

Most helpful comment

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

All 4 comments

Same as #428

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

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)]
 },
},


v3.4.0 added it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

georgehrke picture georgehrke  路  4Comments

BuiHuyCuong picture BuiHuyCuong  路  5Comments

DragosPeta picture DragosPeta  路  3Comments

MaxDiMart picture MaxDiMart  路  5Comments

4spen picture 4spen  路  4Comments