day8 / re-com

A ClojureScript library of reusable components for Reagent
https://re-com.day8.com.au
MIT License
796 stars 147 forks source link

datepicker: shows start and end of month as if it can't be selected when selectable-fn is provided #217

Closed hipitihop closed 3 years ago

hipitihop commented 3 years ago

The datepicker provides the ability to block certain certain days or arbitrary pred via the optional selectable-fn arg. However if the selectable-fn restricts a date, e.g. only Sundays, when this date falls within the week on a month boundary, the date is shown in grey like other non selectable dates. Although the component still allows the user to select the date.

In the following example the selectable-fn only answers true for Sunday dates, and the 28th June 2020 is a valid Sunday date, but see that it appears disabled.

image

When you scroll to the June month, you will see it is correctly shown as available to be selected, however, now the first week (which happens to be slected) is shown as if it is not available for selection.

image

Also note in the latter case, the combination of selection background color and and disabled date text color are hard to read.

superstructor commented 3 years ago

I think this can be generalised as 'the styling of days that are not in the current month, regardless of selectable-fn, is the same as the styling of disabled days'.

In other words, even when there is no selectable-fn and everything is selectable, days outside of the current month are displayed differently.

hipitihop commented 3 years ago

@superstructor agreed, days not in current month should use different styling to disablement by selectable-fn