ToThaiFullDate2

This commit is contained in:
Bright 2024-04-09 11:58:37 +07:00
parent 3786ef4b78
commit a5b0d2e911
2 changed files with 14 additions and 2 deletions

View file

@ -453,7 +453,7 @@ export class ReportController extends Controller {
reportName: "gov1-02",
data: {
date: Extension.ToThaiNumber(
Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-03-01`)),
Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)),
),
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),
@ -922,7 +922,7 @@ export class ReportController extends Controller {
reportName: "gov2-02",
data: {
date: Extension.ToThaiNumber(
Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-03-01`)),
Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)),
),
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),

View file

@ -98,6 +98,18 @@ class Extension {
);
}
public static ToThaiFullDate2(value: Date) {
let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear();
return (
"วันที่ " +
value.getDate() +
" " +
Extension.ToThaiMonth(value.getMonth() + 1) +
" " +
yy
);
}
public static ToThaiShortDate(value: Date) {
let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear();
return (