github.com/blend/go-sdk@v1.20220411.3/timeutil/max.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package timeutil
     9  
    10  import "time"
    11  
    12  // Max returns the earliest (min) time in a list of times.
    13  func Max(times ...time.Time) time.Time {
    14  	if len(times) == 0 {
    15  		return time.Time{}
    16  	}
    17  
    18  	end := times[0]
    19  	for _, t := range times[1:] {
    20  		if t.After(end) {
    21  			end = t
    22  		}
    23  	}
    24  	return end
    25  }