Skip to main content

onchange

Description

Fires when a new option is selected in a date range picker

Usage

onchange?: (ev: {
value: { start: Date; end: Date | null } | null;
}) => void;

Parameters

The callback of the event takes an object with the following parameter:

  • value - (object) an object with the newly selected value (start and end dates of the selected range)

Example

<script>
function handleSelect({value}){
console.log(value);
// => an object with the start and end dates of the selected range
}
</script>

<DateRangePicker onchange={handleSelect} />

Details

The handler function receives an object with the newly selected value of the date range picker (start and end dates of the selected range).


Related article: Catching the change of the selected date

Related sample: DateRangePicker