Passed
Pull Request — master (#431)
by
unknown
05:25
created

src/Domain/HumanResource/Leave/Specification/DoesLeaveRequestLackPostponedWorkedFreeDays.ts   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 16
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 10
mnd 0
bc 0
fnc 1
dl 0
loc 16
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A DoesLeaveRequestLackPostponedWorkedFreeDays.isSatisfiedBy 0 8 1
1
import { DateUtilsAdapter } from 'src/Infrastructure/Adapter/DateUtilsAdapter';
2
const dateUtils: DateUtilsAdapter = new DateUtilsAdapter();
3
4
export class DoesLeaveRequestLackPostponedWorkedFreeDays {
5
  public isSatisfiedBy(startDate: string, endDate: string): boolean {
6
    const workedFreeDays = dateUtils.getWorkedFreeDaysDuringAPeriod(
7
      new Date(startDate),
8
      new Date(endDate)
9
    );
10
11
    return workedFreeDays.some(workedFreeDay =>
12
      dateUtils.isWeekend(workedFreeDay)
13
    );
14
  }
15
}
16