API ข้อมูลตำแหน่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-27 17:19:31 +07:00
parent a595c1a5e9
commit a6293efa69
5 changed files with 99 additions and 23 deletions

View file

@ -1149,6 +1149,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,
@ -1195,5 +1208,6 @@ export const useCounterMixin = defineStore("mixin", () => {
downloadRenameFileByLink,
onSearchDataTable,
formatDatePosition,
};
});