浏览代码

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

正在加载...
取消
保存