// LeaveDaysInRange - count the number of leave days in the range
count the number of leave days in the range
// LeaveDaysInRange - count the number of leave days in the range
func LeaveDaysInRange(start, end *time.Time) int {
	n := 0
	if start == nil || end == nil {
		return n
	}
	var periods []LeavePeriod
	periods = append(periods, LoadLeave()...)
	for d := cal.DayStart(*start); len(periods) > 0 && (d.Before(*end) || d.Equal(*end)); d = d.AddDate(0, 0, 1) {
		period, i := findLeave(periods, d)
		if period == nil {
			continue
		}
		for leaveIncludesTime(*period, d) && (d.Before(*end) || d.Equal(*end)) {
			if c.IsWorkday(d) { 
				n++
			}
			d = d.AddDate(0, 0, 1)
		}
		periods = periods[i+1:]
	}
	return n
}
func LeaveDaysInRange ( start , end * time . Time ) int { n := 0 if start == nil || end == nil { return n } var periods [ ] LeavePeriod periods = append ( periods , LoadLeave ( ) ... ) for d := cal . DayStart ( * start ) ; len ( periods ) > 0 && ( d . Before ( * end ) || d . Equal ( * end ) ) ; d = d . AddDate ( 0 , 0 , 1 ) { period , i := findLeave ( periods , d ) if period == nil { continue } for leaveIncludesTime ( * period , d ) && ( d . Before ( * end ) || d . Equal ( * end ) ) { if c . IsWorkday ( d ) { n ++ } d = d . AddDate ( 0 , 0 , 1 ) } periods = periods [ i + 1 : ] } return n }
count the number of leave days in the range
count the number of leave days in the range
// only count leave on days that would otherwise be a work-day