// TimeUntil is a tiny helper to return the duration until hour:min:sec
// if the duration is in the past and nextDay is true, it'll add 24 hours.
TimeUntil is a tiny helper to return the duration until hour:min:sec
if the duration is in the past and nextDay is true, it'll add 24 hours.
// TimeUntil is a tiny helper to return the duration until hour : min : sec // if the duration is in the past and nextDay is true it ' ll add 24 hours .
func TimeUntil(t time.Time, hour, min, sec int, nextDay bool) time.Duration {
	y, m, d := t.Date()
	nt := time.Date(y, m, d, hour, min, sec, 0, t.Location())
	if nextDay && nt.Before(t) {
		nt = nt.AddDate(0, 0, 1)
	}
	return nt.Sub(t)
}
func TimeUntil ( t time . Time , hour , min , sec int , nextDay bool ) time . Duration { y , m , d := t . Date ( ) nt := time . Date ( y , m , d , hour , min , sec , 0 , t . Location ( ) ) if nextDay && nt . Before ( t ) { nt = nt . AddDate ( 0 , 0 , 1 ) } return nt . Sub ( t ) }
TimeUntil is a tiny helper to return the duration until hour:min:sec
if the duration is in the past and nextDay is true, it'll add 24 hours.
TimeUntil is a tiny helper to return the duration until hour : min : sec if the duration is in the past and nextDay is true it ' ll add 24 hours .