'use client'; import * as React from 'react'; import { ChevronLeft, ChevronRight } from 'lucide-react'; import { format, subDays, subMonths } from 'date-fns'; import { type DateRange } from 'react-day-picker'; import * as Button from '@/components/ui/button'; import * as DatepickerPrimivites from '@/components/ui/datepicker'; import { cn } from '@/utils/cn'; const presets = [ { label: 'Today', dateRange: { from: new Date(), to: new Date(), }, }, { label: 'Last 7 days', dateRange: { from: subDays(new Date(), 7), to: new Date(), }, }, { label: 'Last 30 days', dateRange: { from: subDays(new Date(), 30), to: new Date(), }, }, { label: 'Last 3 months', dateRange: { from: subMonths(new Date(), 3), to: new Date(), }, }, { label: 'Last 12 months', dateRange: { from: subMonths(new Date(), 12), to: new Date(), }, }, { label: 'Month to date', dateRange: { from: new Date(new Date().setDate(1)), to: new Date(), }, }, { label: 'Year to date', dateRange: { from: new Date(new Date().setMonth(0, 1)), to: new Date(), }, }, { label: 'All time', dateRange: { from: new Date(2020, 0, 1), // Varsayılan başlangıç tarihi olarak 2020 yılını kullandım to: new Date(), }, }, ]; function PresetsContainer({ className, ...rest }: React.HTMLAttributes) { return (
); } const PresetItem = React.forwardRef< HTMLButtonElement, React.ButtonHTMLAttributes & { isActive?: boolean; } >(({ className, isActive, ...rest }, forwardedRef) => { return (