v date picker not calling change event when single date is picked - vue.js

I am trying to detect the change event of date picker. It was working fine when user selects multiple days from the calendar. But if user selects a single date, change method not get triggered. My attempt is as below.
<v-date-picker
v-model="dates"
range
color="primary"
id="calendar1"
#change="sendRange"
></v-date-picker>
sendRange(): void {
console.log("executed") // executed for multiple date range selection only
}
Where I was get wrong and how can I fix it?

use #input it will be invoked when a single date selected when the picker is in range mode
Reactive date picker emits input even when any part of the date (year/month/day) changes, but change event is emitted only when the day (for date pickers) or month (for month pickers) changes. If range prop is set, date picker emits change when both [from, to] are selected.
check the documentation
https://vuetifyjs.com/en/api/v-date-picker/#events

Related

Getting the ID of #react-native-community/datetimepicker

I'm using multiple #react-native-community/datetimepicker's in my component and they both call the same function when the user picks a date.
How do I get the ID or name of the datetimepicker the user has used? I checked but was not able to find the ID or name property. This is what the date picker looks like:
<DateTimePicker
testID="myDate1"
value={myDateValue}
mode="date"
display="default"
onChange={this.onCalendarDateChange} />
And this is the function that gets called when the user selects a date:
onCalendarDateChange(event, selectedDate) {
const id = event.???
}
Based on its the document event is an object with two keys
const event: AndroidEvent = {
type: 'set',
nativeEvent: {},
};
it does not return any ID to catch it
After working with this package a while, I realized, the idea is to have a single datetimepicker in a form which is why there's no way to retrieve the ID of the picker.
The simple solution I came up with, which works nicely, is to capture the name of the form field for which the datetimepicker is collecting data when I make it visible.
In my case, I have two form fields for which I needed a datetimepicker i.e. startDate and endDate and initially I was trying to use two separate datetimepicker's in my form. This is completely unnecessary.
I now use a single datetimepicker and when the user clicks the calendar icon to show the datetimepicker, I set the name of the form field i.e. startDate or endDate in the state. Once the user selects a date, the onCalendarDateChange() gets called and I simply read from the state whether it's startDate or endDate field that invoked the datetimepicker.
So anyone who needs a datetimepicker for multiple form fields can simply use a single datetimepicker to get the job done using my or a similar approach.

In krystalcampioni/vue-hotel-datepicker how I can set check-in and check-out dates programmatically?

I'm working on a vue js project in which I'm using vue-hotel-datepicker for date range selection. But how I can to change/set the date range programmatically?
For example, the user selected this example date range. And I want to change the range by adding 1 more day in check-in date programmatically. How I can do this change? There're no such props available in the document as well which I can use to set check-in and check-out dates programmatically.
a little late but
<template> <HotelDatePicker ref="hoteldatesform" /></template>
methods: { setHotelDatePicker(){
this.$refs.hoteldatesform.checkIn = new Date("2021-02-04");
this.$refs.hoteldatesform.checkOut = new Date("2021-02-09");}}

not able to capture telerik vuejs daterangepicker change event

I'm confused on how to capture the daterange event properly. The goal is to fire another event when the date range is changed (start and end dates are selected). But during debugging, it seems like the daterangepricker change event is fired when the start OR the end date is changed....it's hard to captured the "complete" change event because the change event is triggered when one of the dates is changed...so the state of the date range isn't isolated atomically (after start and end date are selected).
Observe the console.log output in the stackblitz during a date range change, it should be clearly depicted.
The expected behavior of the daterangepicker is that the change event wouldn't fired until the "range" event is completed - the start and end dates are selected.
To reproduce...select 20116-01-01 and try to forward through the dates to 2016-12-31....you can't (I mean you can but the start date is lost), when you start cycling through the months it resets the dates so they end up being "null".
The stackblitz (awesome by the way) is here: https://stackblitz.com/edit/js-mrcw3c
Thanks!

Eonsdan-datetimepicker How to set default date in Input when opens first time

im setting default date in Eonasdan-Bootstrap datetimepicker like this
$('#frmDate').data("DateTimePicker").defaultDate(moment().subtract(14, "days").calendar());
I know useCurrent will not fire. but I want to fire it so that when I open calendar first time it should intialized input with default date

How to set click event for datepicker in android

I've just created default datepicker from the link http://www.androidpeople.com/android-datepicker-dialog-example .Its working fine.But my problem is when i click date button.,it shown up..and i change the date and click cancel button on date alert.Again when i click date button.,it should shown current date..not previously changed date. i.e.i just need to get current date at each click whatever the date change.
my solve method may be not the better:when you call OnDateSetListener(),you should save the first date,so when you chick the cancen button,you shululd recover it