gpbl / react-day-picker

DayPicker is a customizable date picker component for React. Add date pickers, calendars, and date inputs to your web applications.
https://daypicker.dev
MIT License
6.02k stars 721 forks source link

No way to set styles of selected days in range mode in v9.0 #2218

Closed punit1108 closed 2 months ago

punit1108 commented 3 months ago

Description

Currently there is no way to add properties for range start selected date and end selected date, which might be useful in a lot of scenarios which customizing the range selection.

image

Expected Behavior

There should be a way to style the radiuses of the start and end selected days

Actual Behavior

No styling property currently corresponds to it.

Steps to Reproduce

  1. Set mode as "range"

Possible Solution

Solution 1 - --rdp-range_start-selected-border-radius --rdp-range_end-selected-border-radius

Solution 2 - Add a way to add Tailwind styles apart from the selected property, eg, range-start-selected range-end-selected

Screenshots

If applicable, add screenshots or GIFs to help explain your problem.

Your Environment

gpbl commented 3 months ago

Hi @punit1108 thanks for your feedback, it's very important before the release.

First of all, please make sure you use the latest version – as it has been updated recently:

npm install react-day-picker@next

Regarding your question - what are you trying to do? Please be more specific about your issue.

Border radius in stored in by var(--rdp-day_date-border-radius). Maybe something like this would help?

.rdp-selected.rdp-range_start {
   /* set the value here to update the variable when range start: */
   --rdp-day_date-border-radius: 0; 
}

Or:

.rdp-selected.rdp-range_start .rdp-day_date {
  /* here you can override the day date content too */
  border-radius: 0; 
}
lariane-guerra commented 2 months ago

Its possible to change in version v8?

image

I need almost this (the second photo its from the playground react day pick):

image
gpbl commented 2 months ago

Hi @lariane-guerra! Here to help...

lariane-guerra commented 2 months ago

Hi, I'll update the version and see.

lariane-guerra commented 2 months ago

image I update to the new version, how i get off this o padding between the days?

lariane-guerra commented 2 months ago

import brazilLocale from 'date-fns/locale/pt-BR'

export const NewDatePickerComponent = styled(DayPicker) future styles here

          <NewDatePickerComponent
            locale={brazilLocale}
            mode="range"
            selected={range}
            onSelect={setRange}
            numberOfMonths={1}
          />

locale={brazilLocale}

I found it: If i remove this, work good, but when i put the brazilocale this what i put in print happen.

lariane-guerra commented 2 months ago

To add: in playground when you change to pt-BR, bug happen too.