Skip to content

Commit 2776105

Browse files
authored
Merge pull request #402 from mashmatrix/fix-date-input-change-to-empty
change input value as empty string when no value set
2 parents a8dfef1 + b68b5bc commit 2776105

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/scripts/DateInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ class DateInputInner extends Component<
358358
? this.state.inputValue
359359
: dateValue != null && mvalue.isValid()
360360
? mvalue.format(this.getInputValueFormat())
361-
: undefined;
361+
: '';
362362
const isOpened = typeof opened !== 'undefined' ? opened : this.state.opened;
363363
const formElemProps = { id, totalCols, cols, label, required, error };
364364
return (

test/storyshots/__snapshots__/storyshots.test.js.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,7 @@ exports[`Storyshots DateInput Controlled with knobs 1`] = `
17911791
onBlur={[Function]}
17921792
onChange={[Function]}
17931793
onKeyDown={[Function]}
1794+
value=""
17941795
/>
17951796
<span
17961797
className="react-slds-button-focus-wrapper"
@@ -13690,6 +13691,7 @@ exports[`Storyshots Form Compound Form 1`] = `
1369013691
onChange={[Function]}
1369113692
onKeyDown={[Function]}
1369213693
placeholder="YYYY/MM/DD"
13694+
value=""
1369313695
/>
1369413696
<span
1369513697
className="react-slds-button-focus-wrapper"
@@ -14218,6 +14220,7 @@ exports[`Storyshots Form Horizontal Form 1`] = `
1421814220
onBlur={[Function]}
1421914221
onChange={[Function]}
1422014222
onKeyDown={[Function]}
14223+
value=""
1422114224
/>
1422214225
<span
1422314226
className="react-slds-button-focus-wrapper"
@@ -14671,6 +14674,7 @@ exports[`Storyshots Form Stacked Form 1`] = `
1467114674
onBlur={[Function]}
1467214675
onChange={[Function]}
1467314676
onKeyDown={[Function]}
14677+
value=""
1467414678
/>
1467514679
<span
1467614680
className="react-slds-button-focus-wrapper"
@@ -46280,6 +46284,7 @@ exports[`Storyshots Modal Form elements 1`] = `
4628046284
onBlur={[Function]}
4628146285
onChange={[Function]}
4628246286
onKeyDown={[Function]}
46287+
value=""
4628346288
/>
4628446289
<span
4628546290
className="react-slds-button-focus-wrapper"
@@ -46336,6 +46341,7 @@ exports[`Storyshots Modal Form elements 1`] = `
4633646341
onBlur={[Function]}
4633746342
onChange={[Function]}
4633846343
onKeyDown={[Function]}
46344+
value=""
4633946345
/>
4634046346
<span
4634146347
className="react-slds-button-focus-wrapper"
@@ -46398,6 +46404,7 @@ exports[`Storyshots Modal Form elements 1`] = `
4639846404
onBlur={[Function]}
4639946405
onChange={[Function]}
4640046406
onKeyDown={[Function]}
46407+
value=""
4640146408
/>
4640246409
<span
4640346410
className="react-slds-button-focus-wrapper"

0 commit comments

Comments
 (0)