เพิ่มฟังก์ชั่นคำนวน diff days ใน mixin

This commit is contained in:
Warunee Tamkoo 2024-04-04 17:33:29 +07:00
parent 492577c34c
commit f0455d45cf

View file

@ -915,6 +915,13 @@ export const useCounterMixin = defineStore("mixin", () => {
return "";
}
function diffDay(startDate: any, endDate: any) {
var d1 = moment(startDate);
var d2 = moment(endDate);
const daydiff = Math.ceil(moment.duration(d2.diff(d1)).asDays());
return daydiff;
}
return {
calAge,
date2Thai,
@ -951,5 +958,6 @@ export const useCounterMixin = defineStore("mixin", () => {
fails,
convertDate,
convertDateDisplay,
diffDay,
};
});