react-day-picker icon indicating copy to clipboard operation
react-day-picker copied to clipboard

showOutsideDays is disabled 1st on month start always on Sunday

Open tyki6 opened this issue 5 months ago • 1 comments

Description

showOutsideDays is disabled 1st on month start always on Sunday

Expected Behavior

On february when showOutsideDays is disabled 1 february start on thursday and not on monday.

Actual Behavior

<DayPicker initialFocus showOutsideDays  mode="range" numberOfMonths={2} defaultMonth={new Date} />

image

<DayPicker initialFocus showOutsideDays={false}  mode="range" numberOfMonths={2} defaultMonth={new Date} />

image

Steps to Reproduce

show two month, in February. code:

<DayPicker initialFocus showOutsideDays  mode="range" numberOfMonths={2} defaultMonth={new Date} />

Possible Solution

If you have a suggestion on how to fix the issue, please include it here.

Your Environment

  • React version: 18.2.0
  • Browser [e.g. chrome, safari]: on all browser
  • Operating System [e.g. iOS, Windows]: x86_64 GNU/Linux
  • Other relevant information: react-day-picker 8.10.0

tyki6 avatar Jan 24 '24 11:01 tyki6

I was facing the same issue. I solved it by fixing the css of the day picker table row (added justify-content-end css property). When we disable the showOutsideDays, the items are shifted towards left for the first row as there are less than seven <tr> in the first row

table: 'w-full border-collapse space-y-1', head_row: 'flex', head_cell: 'text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]', row: 'flex justify-end w-full mt-2', cell: 'text-center text-sm p-0 relative [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20'

deka014 avatar Mar 20 '24 09:03 deka014