คำนวนวันที่ทำงาน

This commit is contained in:
Kittapath 2023-10-09 16:37:30 +07:00
parent 428670b515
commit 87068a9926
2 changed files with 3 additions and 3 deletions

View file

@ -510,12 +510,12 @@ const fetchData = async () => {
monthDiff = monthDiff + d.monthDiff
dayDiff = dayDiff + d.dayDiff
if (dayDiff > 30) {
dayDiff = dayDiff % 30
monthDiff = monthDiff + parseInt((dayDiff / 30).toString())
dayDiff = dayDiff % 30
}
if (monthDiff > 12) {
monthDiff = monthDiff % 12
yearDiff = yearDiff + parseInt((monthDiff / 12).toString())
monthDiff = monthDiff % 12
}
total.value = `${yearDiff > 0 ? yearDiff + ' ปี ' : ''}${
monthDiff > 0 ? monthDiff + ' เดือน ' : ''