From c73c13a9b056771dae9cef1e109f585d5a233929 Mon Sep 17 00:00:00 2001 From: Ashelyn Dawn Date: Sat, 30 Jan 2021 18:16:01 -0700 Subject: [PATCH] DateInput should accept min and max --- components/form/dateInput.js | 7 ++++--- pages/admin/orders/[id]/ship/delivery.js | 2 +- pages/admin/orders/[id]/ship/tracking.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/form/dateInput.js b/components/form/dateInput.js index f5eedeb..d7a50e0 100644 --- a/components/form/dateInput.js +++ b/components/form/dateInput.js @@ -9,7 +9,7 @@ import styles from './styles.module.css' // TODO: At some point make the date input better for accessibility // (currently just skips tab index) -export default function Input({placeholder: _placeholder, label: _label, error, hint, name, value, onChange, onBlur, isValid}){ +export default function DateInput({placeholder: _placeholder, label: _label, error, hint, name, value, onChange, onBlur, isValid, minDate, maxDate}){ const label = (_label === undefined) ? name.replace(name[0], name[0].toUpperCase()) : _label const displayedValue = value ? DateTime.fromISO(value).toFormat('LLLL dd, yyyy') : _placeholder const inputRef = useRef() @@ -22,7 +22,7 @@ export default function Input({placeholder: _placeholder, label: _label, error, } const handleCancel = () => { setModal(false) - setImmediate(()=>inputRef.current?.blur()) + setTimeout(()=>inputRef.current?.blur(), 0) } return ( @@ -40,7 +40,8 @@ export default function Input({placeholder: _placeholder, label: _label, error, layout: 'landscape', showTodayHelper: false }} - maxDate={new Date()} + minDate={minDate} + maxDate={maxDate} selected={value ? DateTime.fromISO(value).toJSDate() : undefined} onSelect={handleDateSelect} /> diff --git a/pages/admin/orders/[id]/ship/delivery.js b/pages/admin/orders/[id]/ship/delivery.js index 26c3bf2..90ecbea 100644 --- a/pages/admin/orders/[id]/ship/delivery.js +++ b/pages/admin/orders/[id]/ship/delivery.js @@ -17,7 +17,7 @@ export default function EnterDelivery({uuid}){

Use this to enter delivery information for packages delivered in-person or at a con.

In case we ever have future corespondence with this person, please be sure to describe where, when, and to who you gave the package.