Files
medusa-store/www/apps/ui/src/examples/date-picker-range-presets-time.tsx
github-actions[bot] dfd9e7c772 chore(docs): Updated UI Reference (#6221)
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2024-01-29 08:20:51 +00:00

53 lines
1.3 KiB
TypeScript

import { DatePicker } from "@medusajs/ui"
export default function DatePickerRangePresetsTime() {
return (
<div className="w-[250px]">
<DatePicker
placeholder="Pick a date"
showTimePicker
mode="range"
presets={[
{
dateRange: {
to: new Date(),
from: new Date(),
},
label: "Today",
},
{
label: "Past 7 days",
dateRange: {
to: new Date(),
from: new Date(new Date().setDate(new Date().getDate() - 7)),
},
},
{
label: "Past 30 days",
dateRange: {
to: new Date(),
from: new Date(new Date().setDate(new Date().getDate() - 30)),
},
},
{
label: "Past 90 days",
dateRange: {
to: new Date(),
from: new Date(new Date().setDate(new Date().getDate() - 90)),
},
},
{
label: "Past year",
dateRange: {
to: new Date(),
from: new Date(
new Date().setFullYear(new Date().getFullYear() - 1)
),
},
},
]}
/>
</div>
)
}