Skip to main content

change

Description

fires when a new date is selected in a calendar

Parameters

  • ev - (object) a CustomEvent object. Its detail property contains:
    • value - (object) an object with the newly selected value of the calendar or null if the value is cleared

Example

<script>
function handleChange(ev){
const newValue = ev.detail;
console.log(newValue);
// =>{value: Thu Apr 20 2023 00:00:00 GMT+0300}
}
</script>

<Calendar value={new Date(2022, 2, 18)} on:change={handleChange}/>

Details

The handler function receives an object with the newly selected value of the calendar or null if the value is cleared.

Related article: Catching the change of the selected date