From a5bdb12c159d1da77436e48c70e0c8ae321b10e4 Mon Sep 17 00:00:00 2001
From: jpveooys <66470099+jpveooys@users.noreply.github.com>
Date: Fri, 3 Dec 2021 16:54:20 +0000
Subject: [PATCH] fix(DatePickerE): Drop value prop passed by Formik
---
.../src/components/DatePickerE/DatePickerE.test.tsx | 9 +++++++++
.../src/components/DatePickerE/DatePickerEInput.tsx | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/packages/react-component-library/src/components/DatePickerE/DatePickerE.test.tsx b/packages/react-component-library/src/components/DatePickerE/DatePickerE.test.tsx
index 3d995e692b..918ae689b9 100644
--- a/packages/react-component-library/src/components/DatePickerE/DatePickerE.test.tsx
+++ b/packages/react-component-library/src/components/DatePickerE/DatePickerE.test.tsx
@@ -1062,6 +1062,15 @@ describe('DatePickerE', () => {
)
})
+ describe('when a startDate and value is specified', () => {
+ // @ts-ignore
+ const jsxToRender =
+
+ it('does not throw an error', () => {
+ expect(() => render(jsxToRender)).not.toThrowError()
+ })
+ })
+
describe.skip('when `startDate` and `endDate` are updated externally', () => {
beforeEach(() => {
const initialProps = {
diff --git a/packages/react-component-library/src/components/DatePickerE/DatePickerEInput.tsx b/packages/react-component-library/src/components/DatePickerE/DatePickerEInput.tsx
index 1c93624317..ca32caf4b0 100644
--- a/packages/react-component-library/src/components/DatePickerE/DatePickerEInput.tsx
+++ b/packages/react-component-library/src/components/DatePickerE/DatePickerEInput.tsx
@@ -22,6 +22,7 @@ export interface DatePickerEInputProps extends ComponentWithClass {
placeholder: string
setHasError: React.Dispatch>
to: Date
+ value?: never
}
export const DatePickerEInput = forwardRef<
@@ -41,6 +42,9 @@ export const DatePickerEInput = forwardRef<
onDayChange,
onFocus,
setHasError,
+ // Drop value as Formik passes it
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ value: _,
...rest
},
ref