diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 76870169..882942ce 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -177,11 +177,11 @@ export class ProfileController extends Controller { LastName: profile.lastName != null ? profile.lastName : "", DateOfBirth: profile.birthDate != null - ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.birthDate)) + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.birthDate)) : "", DateRetire: profile.dateRetire != null - ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.dateRetire)) + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.dateRetire)) : "", RegistrationAddress: Extension.ToThaiNumber( `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`, @@ -197,11 +197,13 @@ export class ProfileController extends Controller { : "", AppointText: profile.dateAppoint != null - ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.dateAppoint)) + ? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.dateAppoint)) : "", SalaryDate: profile.profileSalary.length > 0 && profile.profileSalary[0].date != null - ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalary[0].date)) + ? Extension.ToThaiNumber( + Extension.ToThaiShortDate_perfixMonthYear(profile.profileSalary[0].date), + ) : "", PositionName: profile.position != null ? profile.position : "", OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`, diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index e10f9675..3dafd261 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -123,6 +123,17 @@ class Extension { ); } + public static ToThaiShortDate_perfixMonthYear(value: Date) { + let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear(); + return ( + value.getDate() + + " เดือน " + + Extension.ToThaiShortMonth(value.getMonth() + 1) + + " พ.ศ. " + + yy + ); + } + public static sumObjectValues(array: any, propertyName: any) { let sum = 0; for (let i = 0; i < array.length; i++) {