A-Kasaaian / react-advance-jalaali-datepicker

An advance Jalaali (shamsi, persian) datepicker containing multiple datepicker types such as, range datepicker
MIT License
87 stars 17 forks source link

Adding controlling value for preSelectedEnd #21

Closed khadishi closed 3 years ago

khadishi commented 5 years ago

please add preSelectedEnd to DateRangePicker Component

https://github.com/A-Kasaaian/react-advance-jalaali-datepicker/blob/master/src/DateRangePicker.js Line 69: preSelected={preSelectedStart} => preSelected={preSelectedEnd}

A-Kasaaian commented 5 years ago

@smkhadishi please describe your purpose. I don't see a reason for that it has consequences. By adding preSelectedEnd more validations are required as always should take care of preSelectedStart and end in a way that end stays at the same time or after start.

1- For restart purposes you just need to set preSelectedStart and by updating that both start and end will be reset to the value.

2- If you want to handle values out from outside, that's OK. Again, handle preSelectedStart from your parent component and when you update it from out side it will update both start and end.

The logic says that by updating start date, end should be updated too.

If you have another approach, share it to see if adding it is valuable or not.

Thanks