func (c businessCalendar) daysBetween(from, to date.Date) int {
	if from.After(to) {
		return -c.daysBetween(to, from)
	}

	// Shift both dates to the closest Sunday and then add
	// the weekly shifts in business days.
	i := 0
	start, end := from, to

	if end.Weekday() == time.Saturday {
		end = end.Add(1)
	}
	for end.After(start) && !c.isWeekend(end) {
		end = end.Add(-1)
		i++
	}

	for end.After(start) && !c.isWeekend(start) {
		start = start.Add(1)
		if !c.isWeekend(start) {
			i++
		}
	}
	if start.Weekday() == time.Saturday {
		start = start.Add(1)
	}

	// The ratio between business and weekly days is 5/7.
	return i + end.Sub(start)*5/7
}
// daysBetween computes the number of active dates between
// from (excluded) and to (included).
// This implies there are zero business days from a Friday to
// a weekend day, but there is one between a weekend day and
// a Monday.
daysBetween computes the number of active dates between
from (excluded) and to (included).
This implies there are zero business days from a Friday to
a weekend day, but there is one between a weekend day and
a Monday.
// daysBetween computes the number of active dates between // from ( excluded ) and to ( included ) . // This implies there are zero business days from a Friday to // a weekend day but there is one between a weekend day and // a Monday .
func (c businessCalendar) daysBetween(from, to date.Date) int {
	if from.After(to) {
		return -c.daysBetween(to, from)
	}
	i := 0
	start, end := from, to
	if end.Weekday() == time.Saturday {
		end = end.Add(1)
	}
	for end.After(start) && !c.isWeekend(end) {
		end = end.Add(-1)
		i++
	}
	for end.After(start) && !c.isWeekend(start) {
		start = start.Add(1)
		if !c.isWeekend(start) {
			i++
		}
	}
	if start.Weekday() == time.Saturday {
		start = start.Add(1)
	}
	return i + end.Sub(start)*5/7
}
func ( c businessCalendar ) daysBetween ( from , to date . Date ) int { if from . After ( to ) { return - c . daysBetween ( to , from ) } i := 0 start , end := from , to if end . Weekday ( ) == time . Saturday { end = end . Add ( 1 ) } for end . After ( start ) && ! c . isWeekend ( end ) { end = end . Add ( - 1 ) i ++ } for end . After ( start ) && ! c . isWeekend ( start ) { start = start . Add ( 1 ) if ! c . isWeekend ( start ) { i ++ } } if start . Weekday ( ) == time . Saturday { start = start . Add ( 1 ) } return i + end . Sub ( start ) * 5 / 7 }
daysBetween computes the number of active dates between
from (excluded) and to (included).
daysBetween computes the number of active dates between from ( excluded ) and to ( included ) .
// Shift both dates to the closest Sunday and then add // the weekly shifts in business days. // The ratio between business and weekly days is 5/7.