| 12345678910111213141516 |
- exports.hariKerja = (n, fromDate = null) => {
- const today = fromDate ? new Date(fromDate) : new Date()
- let dayCount = 0;
- while (dayCount < n) {
- // Pindahkan ke hari berikutnya
- today.setDate(today.getDate() + 1);
- // Periksa apakah hari saat ini adalah hari kerja (senin hingga jumat)
- if (today.getDay() !== 0 && today.getDay() !== 6) {
- dayCount++;
- }
- }
- return today.toISOString();
- }
|