Skip to content

Commit 99fffa5

Browse files
committed
fix: add error state to date time picker
1 parent 4960aaa commit 99fffa5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Shared/Components/DatePicker/DateTimePicker.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { DateTimePickerProps } from './types'
3131
import { DATE_PICKER_IDS, DATE_PICKER_PLACEHOLDER, customDayStyles } from './constants'
3232
import './datePicker.scss'
3333
import { ReactComponent as CalendarIcon } from '../../../Assets/Icon/ic-calendar.svg'
34+
import { ReactComponent as ICWarning } from '../../../Assets/Icon/ic-warning.svg'
3435
import { DATE_TIME_FORMATS } from '../../../Common'
3536
import 'react-dates/initialize'
3637
import 'react-dates/lib/css/_datepicker.css'
@@ -51,6 +52,7 @@ const DateTimePicker = ({
5152
dataTestIdForTime = DATE_PICKER_IDS.TIME,
5253
dataTestidForDate = DATE_PICKER_IDS.DATE,
5354
openDirection = 'down',
55+
error = '',
5456
}: DateTimePickerProps) => {
5557
const time = getTimeValue(dateObject)
5658
const selectedTimeOption = DEFAULT_TIME_OPTIONS.find((option) => option.value === time) ?? DEFAULT_TIME_OPTIONS[0]
@@ -122,6 +124,12 @@ const DateTimePicker = ({
122124
</div>
123125
)}
124126
</div>
127+
{error && (
128+
<div className="form__error">
129+
<ICWarning className="form__icon form__icon--error" />
130+
{error}
131+
</div>
132+
)}
125133
</div>
126134
)
127135
}

0 commit comments

Comments
 (0)