svelte-plugins / datepicker

A simple datepicker component designed for Svelte.
https://svelte-plugins.github.io/datepicker
MIT License
54 stars 12 forks source link

feat: add onDateSelected to know if component changes period #7

Closed marcossaore closed 9 months ago

marcossaore commented 9 months ago

New feature

Why these changes? I added a new function onDateSelected to handle previous and next date selection events in the calendar. It is important to know if component has a new period to select. My context: I will make request to the server and when it returns, I want to disable some dates but the component does not provided a function to inform what the period is showing.

How do we test?

  1. Navigate to the calendar component, put onDateSelected={onDateSelected} in component.
  2. Interact with the calendar and click on previous or next buttons.
  3. Observe if the onDateSelected function is triggered appropriately.
  4. I do not create test because the function onDayClick not have one. And I had need to some example to do it.