ระยะเวลาดำลงตำแหน่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-03-03 15:04:42 +07:00
parent 0e5e7ac5be
commit 42301c4830
4 changed files with 184 additions and 76 deletions

View file

@ -1158,6 +1158,19 @@ export const useCounterMixin = defineStore("mixin", () => {
});
}
function formatDatePosition(year: string, month: string, day: string) {
const y = parseInt(year);
const m = parseInt(month);
const d = parseInt(day);
const parts = [];
if (y > 0) parts.push(`${y} ปี`);
if (m > 0) parts.push(`${m} เดือน`);
if (d > 0) parts.push(`${d} วัน`);
return parts.length > 0 ? parts.join(" ") : ""; // กรณีที่ทั้งหมดเป็น 0
}
return {
calAge,
date2Thai,
@ -1197,5 +1210,6 @@ export const useCounterMixin = defineStore("mixin", () => {
findOrgNameOld,
findPosMasterNo,
onSearchDataTable,
formatDatePosition,
};
});