瀏覽代碼

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 月之前
父節點
當前提交
e41c7009d0
共有 1 個檔案被更改,包括 3 行新增2 行删除
  1. +3
    -2
      src/app/utils/holidayUtils.ts

+ 3
- 2
src/app/utils/holidayUtils.ts 查看文件

@@ -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);
};

Loading…
取消
儲存