add a method to check if a date is a NWD

45001-component-to-show-the-list-of-non-working-days-of-year
bsatarnejad 2 years ago
parent 2b59d8fd74
commit bdd0c91ca0
  1. 8
      frontend/src/app/core/state/days/day.service.ts

@ -39,10 +39,16 @@ export class DayResourceService extends ResourceCollectionService<IDay> {
return this
.requireNonWorkingYear$(input)
.pipe(
map((days) => days.findIndex((day:IDay) => !day.working && day.date === date) !== -1),
map((days) => days.findIndex((day:IDay) => day.date === date) !== -1),
);
}
public isNonWorkingDay(date:Date):boolean {
let isNonWorkingDay = false;
this.isNonWorkingDay$(date).subscribe((isNonWorking) => { isNonWorkingDay = isNonWorking; });
return isNonWorkingDay;
}
requireNonWorkingYear$(date:Date):Observable<IDay[]> {
const from = moment(date).startOf('year').format('YYYY-MM-DD');
const to = moment(date).endOf('year').format('YYYY-MM-DD');

Loading…
Cancel
Save