Skip to content

Commit 49400eb

Browse files
committed
MP-27 education form review
1 parent 3b752e2 commit 49400eb

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

src/apps/profiles/src/member-profile/education-and-certifications/EducationCard/EducationCard.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ const EducationCard: FC<EducationCardProps> = (props: EducationCardProps) => (
2424
props.education.timePeriodFrom || props.education.timePeriodTo ? (
2525
<div className={styles.educationCardHeaderRight}>
2626
<p>
27-
{props.education.timePeriodFrom ? moment(props.education.timePeriodFrom)
28-
.format('MM/YYYY') : ''}
29-
{props.education.timePeriodTo || props.education.graduated ? ' - ' : ''}
3027
{props.education.timePeriodTo ? moment(props.education.timePeriodTo)
31-
.format('MM/YYYY') : (props.education.graduated ? 'Graduated' : '')}
28+
.format('YYYY') : ''}
3229
</p>
3330
</div>
3431
) : undefined

src/apps/profiles/src/member-profile/education-and-certifications/ModifyEducationModal/ModifyEducationModal.tsx

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
8585
let value: string | boolean | Date | undefined
8686

8787
switch (key) {
88-
case 'graduated':
89-
value = event.target.checked
90-
break
91-
case 'startDate':
9288
case 'endDate':
9389
value = event as unknown as Date
9490
break
@@ -135,7 +131,6 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
135131
graduated: formValues.graduated,
136132
major: formValues.major,
137133
schoolCollegeName: formValues.schoolCollegeName,
138-
timePeriodFrom: formValues.startDate ? (formValues.startDate as Date).toISOString() : undefined,
139134
timePeriodTo: formValues.endDate ? (formValues.endDate as Date).toISOString() : undefined,
140135
}
141136

@@ -165,7 +160,6 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
165160
graduated: education.graduated,
166161
major: education.major,
167162
schoolCollegeName: education.schoolCollegeName,
168-
startDate: education.timePeriodFrom ? new Date(education.timePeriodFrom) : undefined,
169163
})
170164
}
171165

@@ -257,25 +251,17 @@ const ModifyEducationModal: FC<ModifyEducationModalProps> = (props: ModifyEducat
257251
onChange={bind(handleFormValueChange, this, 'major')}
258252
value={formValues.major as string}
259253
/>
260-
<div className={styles.row}>
261-
<InputDatePicker
262-
label='Start Date'
263-
date={formValues.startDate as Date}
264-
onChange={bind(handleFormValueChange, this, 'startDate')}
265-
disabled={false}
266-
error={formErrors.startDate}
267-
dirty
268-
/>
269-
<InputDatePicker
270-
label='End Date'
271-
date={formValues.endDate as Date}
272-
onChange={bind(handleFormValueChange, this, 'endDate')}
273-
disabled={false}
274-
error={formErrors.endDate}
275-
dirty
276-
maxDate={new Date()}
277-
/>
278-
</div>
254+
<InputDatePicker
255+
label='End date (or expected)'
256+
date={formValues.endDate as Date}
257+
onChange={bind(handleFormValueChange, this, 'endDate')}
258+
disabled={false}
259+
error={formErrors.endDate}
260+
dirty
261+
maxDate={new Date()}
262+
showYearPicker
263+
dateFormat='yyyy'
264+
/>
279265
<div className={styles.formCTAs}>
280266
{editedItemIndex === undefined ? <IconOutline.PlusCircleIcon /> : undefined}
281267
<Button

src/libs/ui/lib/components/form/form-groups/form-input/input-date-picker/InputDatePicker.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface InputDatePickerProps {
1515
date: Date | undefined
1616
onChange: (date: Date | null) => void
1717
readonly className?: string
18+
readonly dateFormat?: string | string[]
1819
readonly dirty?: boolean
1920
readonly disabled: boolean
2021
readonly error?: string
@@ -26,6 +27,7 @@ interface InputDatePickerProps {
2627
readonly minDate?: Date | null | undefined;
2728
readonly minTime?: Date | undefined;
2829
readonly placeholder?: string
30+
readonly showYearPicker?: boolean
2931
readonly tabIndex?: number
3032
}
3133

@@ -106,6 +108,8 @@ const InputDatePicker: FC<InputDatePickerProps> = (props: InputDatePickerProps)
106108
maxDate={props.maxDate}
107109
minTime={props.minTime}
108110
maxTime={props.maxTime}
111+
showYearPicker={props.showYearPicker}
112+
dateFormat={props.dateFormat}
109113
/>
110114
</InputWrapper>
111115
)

0 commit comments

Comments
 (0)