uselessdev / datepicker

A simple datepicker with Chakra-UI and date-fns

Home Page:https://uselessdev-datepicker.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Today Date style overrides selected style (=selection not visible)

Philzen opened this issue · comments

Can be seen at https://uselessdev-datepicker.netlify.app/?path=/docs/calendar--highlight-today

Although one can select today's date, the style doesn't change as it does on every other day.

It seems that variant CalendarDay.variants.today has a higher priority than CalendarDay.variants.selected and thus overrides selected styles, while it should be vice versa.

Thanks again @Philzen

Thanks to you @uselessdev – also for creating this awesome component! ❤️

This fixes the apparent issue at hand, but i realize there is a use case that i'm after that currently doesn't seem possible at the moment. Our datepicker looks like this now:

grafik

28th of June is selected, today is the 26th. What i would love to achieve is a variant that does not exist yet: today + selected, so that in our case, the current day would simply get a border but still be recognizable as the current day. I can see two ways to achieve this:

  1. have selected variant be added to the current style instead of replacing it.
    May be easily possible using the spread operator, but possibly pose a breaking change for people using v2.5.0 and relying on the current behaviour
  2. introduce a new CalendarDay.variants.todaySelected that could be styled separately

I'd love to hear what you think. Of course, this may be off-topic for this bug-related issue, so i could very well create a new one for this feature / enhancement.