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 22, 2020
1 parent aa9ff52 commit 99fc918
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ 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 updateInstantField(field, event) {
if (event.target.value) {
this.<%= entityInstance %>[field] = parse(event.target.value, DATE_TIME_LONG_FORMAT, new Date());
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 99fc918

Please sign in to comment.