Skip to content

Commit c381f24

Browse files
authored
Enable Clear Date Input (#5809)
1 parent d2ff899 commit c381f24

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/shared/components/Settings/Profile/Education/index.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,10 @@ export default class Education extends ConsentComponent {
181181
}
182182

183183
onUpdateDate(date, timePeriod) {
184-
if (date) {
185-
const { newEducation: oldEducation } = this.state;
186-
const newEducation = { ...oldEducation };
187-
newEducation[timePeriod] = date;
188-
this.setState({ newEducation, isSubmit: false });
189-
}
184+
const { newEducation: oldEducation } = this.state;
185+
const newEducation = { ...oldEducation };
186+
newEducation[timePeriod] = date || '';
187+
this.setState({ newEducation, isSubmit: false });
190188
}
191189

192190
/**
@@ -530,6 +528,7 @@ export default class Education extends ConsentComponent {
530528
<div styleName="field col-2">
531529
<DatePicker
532530
readOnly
531+
showClearDate
533532
numberOfMonths={1}
534533
isOutsideRange={moment().subtract(1, 'd')}
535534
date={newEducation.timePeriodFrom}
@@ -559,6 +558,7 @@ export default class Education extends ConsentComponent {
559558
newEducation.graduated ? (
560559
<DatePicker
561560
readOnly
561+
showClearDate
562562
numberOfMonths={1}
563563
isOutsideRange={moment().subtract(1, 'd')}
564564
date={newEducation.timePeriodTo}
@@ -569,6 +569,7 @@ export default class Education extends ConsentComponent {
569569
) : (
570570
<DatePicker
571571
readOnly
572+
showClearDate
572573
numberOfMonths={1}
573574
date={newEducation.timePeriodTo}
574575
id="date-to1"

src/shared/components/Settings/Profile/Education/styles.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ $checkbox-bg-selected: $tc-dark-blue;
1313
flex-direction: column;
1414
align-items: left;
1515

16+
:global {
17+
.SingleDatePickerInput {
18+
&__showClearDate {
19+
padding-right: 0;
20+
}
21+
22+
&_clearDate {
23+
padding: 8px 10px;
24+
top: 20px;
25+
background: transparent;
26+
}
27+
}
28+
}
29+
1630
@include upto-sm {
1731
padding-bottom: 0;
1832
}

0 commit comments

Comments
 (0)