func (s Span) Precedes(r Span) bool {
	return !s.end.After(r.start)
}
Precedes reports whether s ends before or at the start of r.
package timespan
import (
	"time"
)
type Span struct {
	start, end time.Time
}
func New(t time.Time, d time.Duration) Span {
	start := t
	end := t.Add(d)
	if end.Before(t) {
		start, end = end, start
	}
	return Span{
		start: start,
		end:   end,
	}
}
func (s Span) Start() time.Time {
	return s.start
}
func (s Span) End() time.Time {
	return s.end
}
func (s Span) Duration() time.Duration {
	return s.end.Sub(s.start)
}
func (s Span) After(t time.Time) bool {
	return s.start.After(t)
}
func (s Span) Before(t time.Time) bool {
	return s.end.Before(t)
}
func (s Span) Borders(r Span) bool {
	return s.start.Equal(r.end) || s.end.Equal(r.start)
}
func (s Span) ContainsTime(t time.Time) bool {
	return !(t.Before(s.start) || t.After(s.end))
}
func (s Span) Contains(r Span) bool {
	return s.ContainsTime(r.start) && s.ContainsTime(r.end)
}
func (s Span) Encompass(r Span) Span {
	return Span{
		start: tmin(s.start, r.start),
		end:   tmax(s.end, r.end),
	}
}
func (s Span) Equal(r Span) bool {
	return s.start.Equal(r.start) && s.end.Equal(r.end)
}
func (s Span) Follows(r Span) bool {
	return !s.start.Before(r.end)
}
func (s Span) Gap(r Span) Span {
	if s.Overlaps(r) {
		return Span{}
	}
	return Span{
		start: tmin(s.end, r.end),
		end:   tmax(s.start, r.start),
	}
}
func (s Span) Intersection(r Span) (Span, bool) {
	if !s.Overlaps(r) {
		return Span{}, false
	}
	return Span{
		start: tmax(s.start, r.start),
		end:   tmin(s.end, r.end),
	}, true
}
func (s Span) IsZero() bool {
	return s.start.IsZero() && s.end.IsZero()
}
func (s Span) Offset(d time.Duration) Span {
	return Span{
		start: s.start.Add(d),
		end:   s.end.Add(d),
	}
}
func (s Span) OffsetDate(years, months, days int) Span {
	d := s.Duration()
	t := s.start.AddDate(years, months, days)
	return Span{
		start: t,
		end:   t.Add(d),
	}
}
func (s Span) Overlaps(r Span) bool {
	return s.start.Before(r.end) && s.end.After(r.start)
}