From c64ffd8ea8c3c7f02b3c07b072e317a35941d20f Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Wed, 29 May 2024 11:00:13 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=20type=20=E0=B9=80=E0=B8=9B=E0=B9=8A=E0=B8=99=20String?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 21 +++++++++++--------- src/controllers/ProfileEmployeeController.ts | 20 ++++++++++--------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index f51adc5b..10b24067 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -307,13 +307,15 @@ export class ProfileController extends Controller { FirstName: profiles?.firstName != null ? profiles.firstName : "", LastName: profiles?.lastName != null ? profiles.lastName : "", FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`, - BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate() : null, + BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate().toString() : null, BirthDayText: profiles.birthDate != null ? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate)) : "", - BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based - BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null, + BirthMonth: profiles?.birthDate + ? new Date(profiles.birthDate).getMonth() + (1).toString() + : null, // Months are zero-based + BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear().toString() : null, BirthYearText: profiles.birthDate != null ? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate)) @@ -374,8 +376,8 @@ export class ProfileController extends Controller { }); const Training = trainings.map((item) => ({ institute: item.department ?? null, - start: Extension.ToThaiShortDate(item.startDate) ?? null, - end: Extension.ToThaiShortDate(item.endDate) ?? null, + start: Extension.ToThaiShortDate(item.startDate).toString() ?? null, + end: Extension.ToThaiShortDate(item.endDate).toString() ?? null, level: "", degree: "", field: item.place ?? null, @@ -386,7 +388,7 @@ export class ProfileController extends Controller { where: { profileId: id }, }); const Discipline = disciplines.map((item) => ({ - DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null, + DisciplineYear: new Date(item.refCommandDate).getFullYear().toString() ?? null, DisciplineDetail: item.detail ?? null, RefNo: item.refCommandNo ?? null, })); @@ -397,8 +399,8 @@ export class ProfileController extends Controller { }); const Education = educations.map((item) => ({ Institute: item.institute ?? null, - Start: new Date(item.startDate).getFullYear() ?? null, - End: new Date(item.endDate).getFullYear() ?? null, + Start: new Date(item.startDate).getFullYear().toString() ?? null, + End: new Date(item.endDate).getFullYear().toString() ?? null, Level: item.educationLevel ?? null, Degree: item.degree ?? null, Field: item.field ?? null, @@ -424,7 +426,8 @@ export class ProfileController extends Controller { RefAll: item.refCommandNo ?? null, PositionType: item.positionType ?? null, PositionLevel: item.positionLevel ?? null, - PositionAmount: item.positionSalaryAmount == null? null: item.positionSalaryAmount.toString(), + PositionAmount: + item.positionSalaryAmount == null ? null : item.positionSalaryAmount.toString(), FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`, OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`, })); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index d615bbf5..2007fe1e 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -320,13 +320,15 @@ export class ProfileEmployeeController extends Controller { FirstName: profiles?.firstName != null ? profiles.firstName : "", LastName: profiles?.lastName != null ? profiles.lastName : "", FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`, - BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate() : null, + BirthDay: profiles?.birthDate ? new Date(profiles.birthDate).getDate().toString() : null, BirthDayText: profiles.birthDate != null ? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate)) : "", - BirthMonth: profiles?.birthDate ? new Date(profiles.birthDate).getMonth() + 1 : null, // Months are zero-based - BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear() : null, + BirthMonth: profiles?.birthDate + ? new Date(profiles.birthDate).getMonth() + (1).toString() + : null, // Months are zero-based + BirthYear: profiles?.birthDate ? new Date(profiles.birthDate).getFullYear().toString() : null, BirthYearText: profiles.birthDate != null ? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate)) @@ -368,7 +370,7 @@ export class ProfileEmployeeController extends Controller { AppointDate: profiles?.dateAppoint, BirthDate: profiles?.birthDate ? Extension.ToThaiShortDate(profiles.birthDate) : null, RetireDate: profiles?.dateRetireLaw, - AvatarId: profiles?.avatar ?? null, + // AvatarId: profiles?.avatar ?? null, }; const certs = await this.certificateRepository.find({ @@ -387,8 +389,8 @@ export class ProfileEmployeeController extends Controller { }); const Training = trainings.map((item) => ({ institute: item.department ?? null, - start: Extension.ToThaiShortDate(item.startDate) ?? null, - end: Extension.ToThaiShortDate(item.endDate) ?? null, + start: Extension.ToThaiShortDate(item.startDate).toString() ?? null, + end: Extension.ToThaiShortDate(item.endDate).toString() ?? null, level: "", degree: "", field: item.place ?? null, @@ -399,7 +401,7 @@ export class ProfileEmployeeController extends Controller { where: { profileEmployeeId: id }, }); const Discipline = disciplines.map((item) => ({ - DisciplineYear: new Date(item.refCommandDate).getFullYear() ?? null, + DisciplineYear: new Date(item.refCommandDate).getFullYear().toString() ?? null, DisciplineDetail: item.detail ?? null, RefNo: item.refCommandNo ?? null, })); @@ -410,8 +412,8 @@ export class ProfileEmployeeController extends Controller { }); const Education = educations.map((item) => ({ Institute: item.institute ?? null, - Start: new Date(item.startDate).getFullYear() ?? null, - End: new Date(item.endDate).getFullYear() ?? null, + Start: new Date(item.startDate).getFullYear().toString() ?? null, + End: new Date(item.endDate).getFullYear().toString() ?? null, Level: item.educationLevel ?? null, Degree: item.degree ?? null, Field: item.field ?? null,