From 56cab850f8552d1dc6b28a9da6015d21ae50b058 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Tue, 16 Jun 2020 18:46:20 +0530 Subject: [PATCH] feat: map all dates from server in HTTP services Fix #482 --- .../app/entities/entity-update.component.ts.ejs | 11 +++++++++-- .../entity-management-update.component.spec.ts.ejs | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity-update.component.ts.ejs b/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity-update.component.ts.ejs index d11b8c69..00fff4a2 100644 --- a/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity-update.component.ts.ejs +++ b/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity-update.component.ts.ejs @@ -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; } diff --git a/generators/entity-client/templates/vue/src/test/javascript/spec/app/entities/entity-management-update.component.spec.ts.ejs b/generators/entity-client/templates/vue/src/test/javascript/spec/app/entities/entity-management-update.component.spec.ts.ejs index 9c3b92c1..f08f8187 100644 --- a/generators/entity-client/templates/vue/src/test/javascript/spec/app/entities/entity-management-update.component.spec.ts.ejs +++ b/generators/entity-client/templates/vue/src/test/javascript/spec/app/entities/entity-management-update.component.spec.ts.ejs @@ -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', () => {