Skip to content

Commit

Permalink
fix(ui): The date-range-picker can only select dates before the curre…
Browse files Browse the repository at this point in the history
…nt date (#1845)

* fix(ui): date-range-picker only able to select before current date

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
wwayne and autofix-ci[bot] authored Apr 15, 2024
1 parent 733b4a6 commit ac352ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ee/tabby-ui/components/ui/date-range-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import * as React from 'react'
import { CalendarIcon } from '@radix-ui/react-icons'
import { addDays, format } from 'date-fns'
import moment from 'moment'
import { DateRange } from 'react-day-picker'

import { cn } from '@/lib/utils'
Expand Down Expand Up @@ -68,10 +69,11 @@ export default function DatePickerWithRange({
<Calendar
initialFocus
mode="range"
defaultMonth={date?.from}
defaultMonth={moment(date?.from).subtract(1, 'month').toDate()}
selected={date}
onSelect={setDate}
numberOfMonths={2}
disabled={(date: Date) => date > new Date()}
/>
</PopoverContent>
</Popover>
Expand Down

0 comments on commit ac352ef

Please sign in to comment.