Home / Function/ DatePickerWithRange() — ui Function Reference

DatePickerWithRange() — ui Function Reference

Architecture documentation for the DatePickerWithRange() function in date-picker-demo.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  bd0ed6af_b808_bb66_ca00_864fa2a1502c["DatePickerWithRange()"]
  c8a1c243_9ab4_c534_0c61_9dd60705e506["date-picker-demo.tsx"]
  bd0ed6af_b808_bb66_ca00_864fa2a1502c -->|defined in| c8a1c243_9ab4_c534_0c61_9dd60705e506
  style bd0ed6af_b808_bb66_ca00_864fa2a1502c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/app/(internal)/sink/components/date-picker-demo.tsx lines 60–103

function DatePickerWithRange() {
  const [date, setDate] = React.useState<DateRange | undefined>({
    from: new Date(new Date().getFullYear(), 0, 20),
    to: addDays(new Date(new Date().getFullYear(), 0, 20), 20),
  })

  return (
    <Popover>
      <PopoverTrigger asChild>
        <Button
          id="date"
          variant={"outline"}
          className={cn(
            "w-fit justify-start px-2 font-normal",
            !date && "text-muted-foreground"
          )}
        >
          <CalendarIcon className="text-muted-foreground" />
          {date?.from ? (
            date.to ? (
              <>
                {format(date.from, "LLL dd, y")} -{" "}
                {format(date.to, "LLL dd, y")}
              </>
            ) : (
              format(date.from, "LLL dd, y")
            )
          ) : (
            <span>Pick a date</span>
          )}
        </Button>
      </PopoverTrigger>
      <PopoverContent className="w-auto p-0" align="start">
        <Calendar
          mode="range"
          defaultMonth={date?.from}
          selected={date}
          onSelect={setDate}
          numberOfMonths={2}
        />
      </PopoverContent>
    </Popover>
  )
}

Subdomains

Frequently Asked Questions

What does DatePickerWithRange() do?
DatePickerWithRange() is a function in the ui codebase, defined in apps/v4/app/(internal)/sink/components/date-picker-demo.tsx.
Where is DatePickerWithRange() defined?
DatePickerWithRange() is defined in apps/v4/app/(internal)/sink/components/date-picker-demo.tsx at line 60.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free