Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
feat: map all dates from server in HTTP services
Browse files Browse the repository at this point in the history
Fix #482
  • Loading branch information
snitin315 committed Jun 16, 2020
1 parent aa9ff52 commit 56cab85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,16 @@ export default class <%= entityAngularName %>Update extends <% if (fieldsContain
if ([ 'Instant', 'ZonedDateTime' ].includes(fieldType) && !dateFunctionIncluded) {
dateFunctionIncluded = true;
_%>
public convertDateTimeFromServer(date: Date): string {
public convertDateTimeFromServer(date: Date): Date {
if (date) {
return format(date, DATE_TIME_LONG_FORMAT);
return date;
}
return null;
}

public convertDateTimeArrayFromServer(dates: Date[]): Date[] {
if (dates) {
return dates;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('Component Tests', () => {
const convertedDate = comp.convertDateTimeFromServer(date);

// THEN
expect(convertedDate).toEqual(format(date, DATE_TIME_LONG_FORMAT));
expect(convertedDate).toEqual(date);
});

it('Should not convert date if date is not present', () => {
Expand Down

0 comments on commit 56cab85

Please sign in to comment.