ปรับฟอร์มการลา
This commit is contained in:
parent
e850f4fd8a
commit
ca4c3565bd
7 changed files with 431 additions and 391 deletions
|
|
@ -931,6 +931,24 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
}
|
||||
}
|
||||
|
||||
function calculateDurationYmd(startDate: string | null, endDate: string | null) {
|
||||
if (startDate && endDate) {
|
||||
const start = new Date(startDate);
|
||||
const end = new Date(endDate);
|
||||
|
||||
const duration = end.getTime() - start.getTime(); // ระยะเวลาในมิลลิวินาที
|
||||
|
||||
const days = Math.floor(duration / (1000 * 60 * 60 * 24));
|
||||
const months = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44));
|
||||
const years = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44 * 12));
|
||||
|
||||
// return `${days} วัน, ${months} เดือน, ${years} ปี`;
|
||||
return `${years} ปี, ${months} เดือน, ${days} วัน`;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
return {
|
||||
calAge,
|
||||
date2Thai,
|
||||
|
|
@ -963,5 +981,6 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
dialogConfirm,
|
||||
dialogRemove,
|
||||
arabicNumberToText,
|
||||
calculateDurationYmd
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue