File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
src/components/date-input Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ exports[`DateInput matches snapshot 1`] = `
2020 <Component >
2121 <IndividualDateInput
2222 inputType = " day"
23+ pattern = " [0-9]*"
2324 >
2425 <div
2526 className = " nhsuk-date-input__item"
@@ -52,6 +53,7 @@ exports[`DateInput matches snapshot 1`] = `
5253 id = " testInput-day"
5354 name = " testInput-day"
5455 onChange = { [Function ]}
56+ pattern = " [0-9]*"
5557 />
5658 </div >
5759 </div >
@@ -60,6 +62,7 @@ exports[`DateInput matches snapshot 1`] = `
6062 <Component >
6163 <IndividualDateInput
6264 inputType = " month"
65+ pattern = " [0-9]*"
6366 >
6467 <div
6568 className = " nhsuk-date-input__item"
@@ -92,6 +95,7 @@ exports[`DateInput matches snapshot 1`] = `
9295 id = " testInput-month"
9396 name = " testInput-month"
9497 onChange = { [Function ]}
98+ pattern = " [0-9]*"
9599 />
96100 </div >
97101 </div >
@@ -100,6 +104,7 @@ exports[`DateInput matches snapshot 1`] = `
100104 <Component >
101105 <IndividualDateInput
102106 inputType = " year"
107+ pattern = " [0-9]*"
103108 >
104109 <div
105110 className = " nhsuk-date-input__item"
@@ -132,6 +137,7 @@ exports[`DateInput matches snapshot 1`] = `
132137 id = " testInput-year"
133138 name = " testInput-year"
134139 onChange = { [Function ]}
140+ pattern = " [0-9]*"
135141 />
136142 </div >
137143 </div >
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ const IndividualDateInput: React.FC<IndividualDateInputProps> = ({
9393 ) ;
9494} ;
9595
96+ IndividualDateInput . defaultProps = {
97+ pattern : '[0-9]*' ,
98+ } ;
99+
96100export const DayInput : React . FC < Omit < IndividualDateInputProps , 'inputType' > > = props => (
97101 < IndividualDateInput inputType = "day" { ...props } />
98102) ;
You can’t perform that action at this time.
0 commit comments