import { Controller } from "react-hook-form" import { NestedForm } from "../../../../utils/nested-form" import DatePicker from "../../../atoms/date-picker/date-picker" import TimePicker from "../../../atoms/date-picker/time-picker" import SwitchableItem from "../../../molecules/switchable-item" export type GiftCardEndsAtFormType = { ends_at: Date | null } type GiftCardEndsAtFormProps = { form: NestedForm } const GiftCardEndsAtForm = ({ form }: GiftCardEndsAtFormProps) => { const { control, path } = form return ( { return ( { if (value) { onChange(null) } else { onChange( new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000) ) } }} title="Gift Card has an expiry date?" description="Schedule the Gift Card to deactivate in the future." >
) }} /> ) } export default GiftCardEndsAtForm