WickyNilliams / cally

Small, feature-rich calendar components
https://wicky.nillia.ms/cally/
MIT License
1.06k stars 12 forks source link

Calendar Range Picker Resets Incorrectly After Abandoning Selection #52

Closed Cata1989 closed 3 weeks ago

Cata1989 commented 3 weeks ago

When using the Range Picker, if I start selecting a range by choosing the Range Start date and then scroll through several months without completing the selection, and then click outside the Range Picker to abandon the selection, the expected behavior is to reset the calendar view to the current day upon reopening the Range Picker. However, currently, it shows the view of the last abandoned selection instead of resetting to the current day and I suppose that's a bug in the Cally library. Hope to give us a solution for that.

Steps to Reproduce:

  1. Open the Range Picker.
  2. Select a start date for the range.
  3. Scroll through several months.
  4. Click outside the Range Picker to abandon the selection.
  5. Reopen the Range Picker.

Expected Behavior: The Range Picker should reset to display the current day's view when reopened after an abandoned selection.

Actual Behavior: The Range Picker displays the view of the last abandoned selection instead of resetting to the current day's view.

Impact: This behavior can be confusing for users, as they might expect the calendar to reset to the current day when they reattempt the selection process.

Small example here:

https://github.com/WickyNilliams/cally/assets/98550729/f02dd292-de98-4f3b-b3b2-9e12d9b3b5d4

dgonzalezr commented 3 weeks ago

@WickyNilliams to give a bit more context, I tried resetting the focusedDate once the panel is closed (same as tentative) but the behavior remains the same as explained above.

WickyNilliams commented 3 weeks ago

Can you provide a reduced test case please. I am not able to replicate here: https://codepen.io/WickyNilliams/pen/PovjEvK

https://github.com/WickyNilliams/cally/assets/1091390/16afd74a-8ca1-4547-a888-344408016869

WickyNilliams commented 3 weeks ago

In future can you please write bug reports from the perspective of cally. Most of the bug report is from the perspective of your component, which isn't hugely helpful. Thanks!

WickyNilliams commented 3 weeks ago

I tried resetting the focusedDate

am i reading it right you are setting to empty string? if so, you shouldn't reset it to empty, you should set it to a specific date. like today's date or whatever makes sense for you.

if no focusedDate is set initially, internally it defaults to today's date. but after that it's up to you to decide what to do.

hope that makes sense

dgonzalezr commented 3 weeks ago

I tried resetting the focusedDate

am i reading it right you are setting to empty string? if so, you shouldn't reset it to empty, you should set it to a specific date. like today's date or whatever makes sense for you.

if no focusedDate is set initially, internally it defaults to today's date. but after that it's up to you to decide what to do.

hope that makes sense

No, I'm not setting it to an empty string I'm relying either on the value selected or today's day. I'll try to create a simple reproduction case :)

dgonzalezr commented 3 weeks ago

In future can you please write bug reports from the perspective of cally. Most of the bug report is from the perspective of your component, which isn't hugely helpful. Thanks!

Apologies for that, it wasn't our intention.

dgonzalezr commented 3 weeks ago

@WickyNilliams please feel free to close this as it is no longer relevant, the issue was largely on our end. I'm sorry for any trouble caused.

WickyNilliams commented 3 weeks ago

No worries! This is why a minimal reproduction is useful :) thanks for reporting back