github.com/blend/go-sdk@v1.20220411.3/timeutil/min.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  // Min returns the earliest (min) time in a list of times.
    13  func Min(times ...time.Time) (min time.Time) {
    14  	if len(times) == 0 {
    15  		return
    16  	}
    17  
    18  	min = times[0]
    19  	for _, t := range times[1:] {
    20  		if t.Before(min) {
    21  			min = t
    22  		}
    23  	}
    24  	return
    25  }