Merge pull request #717 from chandiwalaaadhar/fix/integrations-empty-date-sections-not-loading

Fix-Json with Empty Date Strings in Sections doesn't get loaded in the Resume
This commit is contained in:
Amruth Pillai
2022-03-16 11:48:34 +01:00
committed by GitHub

View File

@ -105,8 +105,8 @@ export class IntegrationsService {
institution: get(school, 'School Name'), institution: get(school, 'School Name'),
degree: get(school, 'Degree Name'), degree: get(school, 'Degree Name'),
date: { date: {
start: dayjs(get(school, 'Start Date')).toISOString(), start: this.parseDate(get(school, 'Start Date')),
end: dayjs(get(school, 'End Date')).toISOString(), end: this.parseDate(get(school, 'End Date')),
}, },
} as Education, } as Education,
], ],
@ -134,8 +134,8 @@ export class IntegrationsService {
position: get(position, 'Title'), position: get(position, 'Title'),
summary: get(position, 'Description'), summary: get(position, 'Description'),
date: { date: {
start: dayjs(get(position, 'Started On')).toISOString(), start: this.parseDate(get(position, 'Started On')),
end: dayjs(get(position, 'Finished On')).toISOString(), end: this.parseDate(get(position, 'Finished On')),
}, },
} as WorkExperience, } as WorkExperience,
], ],
@ -162,7 +162,7 @@ export class IntegrationsService {
name: get(certification, 'Name'), name: get(certification, 'Name'),
issuer: get(certification, 'Authority'), issuer: get(certification, 'Authority'),
url: get(certification, 'Url'), url: get(certification, 'Url'),
date: dayjs(get(certification, 'Started On')).toISOString(), date: this.parseDate(get(certification, 'Started On')),
} as Certificate, } as Certificate,
], ],
}, },
@ -214,8 +214,8 @@ export class IntegrationsService {
description: get(project, 'Description'), description: get(project, 'Description'),
url: get(project, 'Url'), url: get(project, 'Url'),
date: { date: {
start: dayjs(get(project, 'Started On')).toISOString(), start: this.parseDate(get(project, 'Started On')),
end: dayjs(get(project, 'Finished On')).toISOString(), end: this.parseDate(get(project, 'Finished On')),
}, },
} as Project, } as Project,
], ],
@ -338,8 +338,8 @@ export class IntegrationsService {
summary: get(item, 'summary'), summary: get(item, 'summary'),
url: get(item, 'url'), url: get(item, 'url'),
date: { date: {
start: dayjs(get(item, 'startDate')).toISOString(), start: this.parseDate(get(item, 'startDate')),
end: dayjs(get(item, 'endDate')).toISOString(), end: this.parseDate(get(item, 'endDate')),
}, },
} as WorkExperience, } as WorkExperience,
], ],
@ -367,8 +367,8 @@ export class IntegrationsService {
summary: get(item, 'summary'), summary: get(item, 'summary'),
url: get(item, 'url'), url: get(item, 'url'),
date: { date: {
start: dayjs(get(item, 'startDate')).toISOString(), start: this.parseDate(get(item, 'startDate')),
end: dayjs(get(item, 'endDate')).toISOString(), end: this.parseDate(get(item, 'endDate')),
}, },
} as Volunteer, } as Volunteer,
], ],
@ -398,8 +398,8 @@ export class IntegrationsService {
url: get(item, 'url'), url: get(item, 'url'),
courses: get(item, 'courses', []), courses: get(item, 'courses', []),
date: { date: {
start: dayjs(get(item, 'startDate')).toISOString(), start: this.parseDate(get(item, 'startDate')),
end: dayjs(get(item, 'endDate')).toISOString(), end: this.parseDate(get(item, 'endDate')),
}, },
} as Education, } as Education,
], ],
@ -426,7 +426,7 @@ export class IntegrationsService {
awarder: get(award, 'awarder'), awarder: get(award, 'awarder'),
summary: get(award, 'summary'), summary: get(award, 'summary'),
url: get(award, 'url'), url: get(award, 'url'),
date: dayjs(get(award, 'date')).toISOString(), date: this.parseDate(get(award, 'date')),
} as Award, } as Award,
], ],
}, },
@ -452,7 +452,7 @@ export class IntegrationsService {
publisher: get(publication, 'publisher'), publisher: get(publication, 'publisher'),
summary: get(publication, 'summary'), summary: get(publication, 'summary'),
url: get(publication, 'url'), url: get(publication, 'url'),
date: dayjs(get(publication, 'releaseDate')).toISOString(), date: this.parseDate(get(publication, 'releaseDate')),
} as Publication, } as Publication,
], ],
}, },
@ -575,8 +575,8 @@ export class IntegrationsService {
keywords: get(project, 'keywords'), keywords: get(project, 'keywords'),
url: get(project, 'url'), url: get(project, 'url'),
date: { date: {
start: dayjs(get(project, 'startDate')).toISOString(), start: this.parseDate(get(project, 'startDate')),
end: dayjs(get(project, 'endDate')).toISOString(), end: this.parseDate(get(project, 'endDate')),
}, },
} as Project, } as Project,
], ],
@ -692,8 +692,8 @@ export class IntegrationsService {
summary: get(item, 'summary'), summary: get(item, 'summary'),
url: get(item, 'website'), url: get(item, 'website'),
date: { date: {
start: dayjs(get(item, 'startDate')).toISOString(), start: this.parseDate(get(item, 'startDate')),
end: dayjs(get(item, 'endDate')).toISOString(), end: this.parseDate(get(item, 'endDate')),
}, },
} as WorkExperience, } as WorkExperience,
], ],
@ -724,8 +724,8 @@ export class IntegrationsService {
summary: get(item, 'summary'), summary: get(item, 'summary'),
courses: get(item, 'courses', []), courses: get(item, 'courses', []),
date: { date: {
start: dayjs(get(item, 'startDate')).toISOString(), start: this.parseDate(get(item, 'startDate')),
end: dayjs(get(item, 'endDate')).toISOString(), end: this.parseDate(get(item, 'endDate')),
}, },
} as Education, } as Education,
], ],
@ -751,7 +751,7 @@ export class IntegrationsService {
title: get(award, 'title'), title: get(award, 'title'),
awarder: get(award, 'awarder'), awarder: get(award, 'awarder'),
summary: get(award, 'summary'), summary: get(award, 'summary'),
date: dayjs(get(award, 'date')).toISOString(), date: this.parseDate(get(award, 'date')),
} as Award, } as Award,
], ],
}, },
@ -776,7 +776,7 @@ export class IntegrationsService {
name: get(certificate, 'title'), name: get(certificate, 'title'),
issuer: get(certificate, 'issuer'), issuer: get(certificate, 'issuer'),
summary: get(certificate, 'summary'), summary: get(certificate, 'summary'),
date: dayjs(get(certificate, 'date')).toISOString(), date: this.parseDate(get(certificate, 'date')),
} as Certificate, } as Certificate,
], ],
}, },
@ -900,7 +900,7 @@ export class IntegrationsService {
keywords: get(project, 'keywords'), keywords: get(project, 'keywords'),
url: get(project, 'link'), url: get(project, 'link'),
date: { date: {
start: dayjs(get(project, 'date')).toISOString(), start: this.parseDate(get(project, 'startDate')),
}, },
} as Project, } as Project,
], ],
@ -945,4 +945,8 @@ export class IntegrationsService {
await unlink(path); await unlink(path);
} }
} }
private parseDate = (date: string): string => {
return isEmpty(date) ? '' : dayjs(date).toISOString();
};
} }