package com.brilliance.isc.common.irtcal.days.impl;

import com.brilliance.isc.common.irtcal.days.IrtDaysCalculator;
import com.brilliance.mda.runtime.mda.util.Dates;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component("CAL")
public class CalIrtDaysCalculatorImpl implements IrtDaysCalculator {

    @Override
    public int calculateDays(Date begdat, Date enddat, boolean includeEnddat) {
        int days = Dates.diff(enddat, begdat);
        if (includeEnddat) {
            days = days + 1;
        }
        return days;
    }
}
