This commit is contained in:
Warunee Tamkoo 2025-03-05 22:46:10 +07:00
parent d2a2af53de
commit 4b160bb48c

View file

@ -1154,13 +1154,13 @@ export const useCounterMixin = defineStore("mixin", () => {
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} วัน`);
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 `${y} ปี ${m} เดือน ${d} วัน`;
return parts.length > 0 ? parts.join(" ") : `${y} ปี ${m} เดือน ${d} วัน`; // กรณีที่ทั้งหมดเป็น 0
// return `${y} ปี ${m} เดือน ${d} วัน`;
}
return {