react-kronos icon indicating copy to clipboard operation
react-kronos copied to clipboard

Date Changes With Month Buttons

Open Wartybliggens opened this issue 6 years ago • 3 comments

Hello and thanks for kronos! I have one big issue: when using the arrow buttons to change the calendar month, the date in the input changes. This is unexpected behavior. I would expect the date to only change when I select a specific day from the calendar (by clicking on it). The month buttons should only be for navigating. And besides that, it shouldn't be possible to change the date in the input to a date that's out of range, but that's what happens: I am (correctly) prevented from clicking on out-of-range days, but by advancing the month out of range the input date changes anyway. That should not be possible.

Wartybliggens avatar Jan 31 '18 03:01 Wartybliggens

please fix this :(

CarrierDirectMatt avatar Jun 26 '18 20:06 CarrierDirectMatt

@Wartybliggens @CarrierDirectMatt Thanks for bringing this up, my apologies for not addressing it sooner.

The way I designed and implemented this component, this is expected behavior. Every time the user clicks on a button, it makes a change:

  • The year arrows change the years
  • The month arrows change the months
  • Clicking on a year, month, or day selects that specific one

You do bring up a valid concern being, if the prop preventClickOnDateTimeOutsideRange is true, then the user should not be able to modify/advance the input to a date that is not allowed.

I will address this, I'm just not sure of the best way forward. My current line of thought is making it so that if preventClickOnDateTimeOutsideRange is true, then the arrows only navigate.

felixakiragreen avatar Jun 27 '18 13:06 felixakiragreen

Thank you @dubert for looking at this. I still think it's strange that the navigation at the top of the dropdown would change the date, when I would expect it to get me to a place where I can choose the day. My suggestion would be to make this an explicit toggle, like "changeDateWithNavigation", defaulting to true for backwards-compatibility.

Wartybliggens avatar Jun 28 '18 18:06 Wartybliggens