fix: notify text when negative
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
parent
749d25b1cf
commit
26c671b032
1 changed files with 4 additions and 1 deletions
|
|
@ -153,7 +153,10 @@ export class WebHookController extends Controller {
|
|||
dayjs(item.expireDate).format("DD/MM/") + (dayjs(item.expireDate).year() + 543);
|
||||
const diffDate = dayjs(item.expireDate).diff(dayjs(), "day");
|
||||
|
||||
return `${index + 1}. คุณ${item.firstName} ${item.lastName} วันหมดอายุเอกสาร : ${dateFormat} ใกล้หมดอายุอีก ${diffDate} วัน\n ${process.env.LINE_LIFF_URL}/${item.employeeId}`;
|
||||
if (diffDate > 0) {
|
||||
return `${index + 1}. คุณ${item.firstName} ${item.lastName} วันหมดอายุเอกสาร : ${dateFormat} ใกล้หมดอายุอีก ${diffDate} วัน\n ${process.env.LINE_LIFF_URL}/${item.employeeId}`;
|
||||
}
|
||||
return `${index + 1}. คุณ${item.firstName} ${item.lastName} วันหมดอายุเอกสาร : ${dateFormat} หมดอายุไปแล้ว ${Math.abs(diffDate)} วัน \n ${process.env.LINE_LIFF_URL}/${item.employeeId}`;
|
||||
})
|
||||
.join("\n");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue