Sfoglia il codice sorgente

Update holiday lists, to include last year to avoid missing last year holiday when inputing timesheet that has current year and last year

tags/Baseline_180220205_Frontend
MSI\2Fi 7 mesi fa
parent
commit
e41c7009d0
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. +3
    -2
      src/app/utils/holidayUtils.ts

+ 3
- 2
src/app/utils/holidayUtils.ts Vedi File

@@ -13,7 +13,8 @@ export const getPublicHolidaysForNYears = (years: number = 1, currYr?: number) =
.fill(undefined)
.flatMap((_, index) => {
const currentYear = currYr ?? new Date().getFullYear();
const holidays = hd.getHolidays(currentYear + index);
const holidays = hd.getHolidays(currentYear - index);
console.log(holidays)
return holidays.map((ele) => {
const tempDay = new Date(ele.date);
const tempYear = tempDay.getFullYear();
@@ -66,7 +67,7 @@ export const getHolidayForDate = (
INPUT_DATE_FORMAT,
),
}))
.concat(getPublicHolidaysForNYears(1).concat());
.concat(getPublicHolidaysForNYears(2).concat());

return currentYearHolidays.find((h) => h.date === date);
};

Caricamento…
Annulla
Salva