mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
fix: set time format right (#17402)
This commit is contained in:
@@ -70,3 +70,13 @@ func ParseHeader(timeStr string) (time.Time, error) {
|
||||
}
|
||||
return time.Time{}, ErrMalformedDate
|
||||
}
|
||||
|
||||
// ParseReplicationTS parse http.TimeFormat first
|
||||
// will try time.RFC3339Nano when parse http.TimeFormat failed
|
||||
func ParseReplicationTS(str string) (time.Time, error) {
|
||||
tm, err := time.Parse(http.TimeFormat, str)
|
||||
if tm.IsZero() || err != nil {
|
||||
tm, err = time.Parse(time.RFC3339Nano, str)
|
||||
}
|
||||
return tm, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user