Skip to content

Commit

Permalink
change: adding is clearable as an option (#441)
Browse files Browse the repository at this point in the history
Co-authored-by: Ishdeep Singh <[email protected]>
  • Loading branch information
Singh-Ish and Ishdeep Singh authored Nov 6, 2024
1 parent 965f3fd commit 44f67b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/components/Form/DateTime/DateTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export interface DateTimeProps extends FieldComponentProps {
dateFormat?: string
timeFormat?: string
placeholder?: string
isClearable?: boolean
onChange?: (date: Date | null) => void
}

export const DateTime = ({ ...props }: DateTimeProps) => {
const { name, placeholder, dateFormat = 'MMMM d, yyyy', showTime, timeFormat, onChange, ...rest } = props
const { name, placeholder, dateFormat = 'MMMM d, yyyy', showTime, timeFormat, onChange, isClearable, ...rest } = props

const [field, , helpers] = useField(name)

Expand All @@ -35,7 +36,7 @@ export const DateTime = ({ ...props }: DateTimeProps) => {
return (
<>
<DatePicker
isClearable
isClearable={isClearable}
name={name}
id={name}
autoComplete="on"
Expand Down
1 change: 1 addition & 0 deletions lib/components/Form/Form.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ export const SimpleDate: Story = () => {
name="startDate"
maxDate={formikProps.values.endDate}
disabled={formikProps.isSubmitting}
isClearable
/>
<Form.FieldControl
required
Expand Down

0 comments on commit 44f67b5

Please sign in to comment.