stat: avoid unix epoch time when printing date (#4398)

This commit is contained in:
Harshavardhana
2022-12-09 11:38:22 -08:00
committed by GitHub
parent 62d07d5ea1
commit daa06599e4
+4 -2
View File
@@ -248,7 +248,7 @@ func statURL(ctx context.Context, targetURL, versionID string, timeRef time.Time
contentURL = strings.TrimPrefix(contentURL, prefixPath)
bstat.URL.Path = contentURL
if bstat.Date.IsZero() || bstat.Date.Equal(time.Unix(0, 0)) {
if bstat.Date.IsZero() || bstat.Date.Equal(timeSentinel) {
bstat.Date = content.Time
}
var bu madmin.BucketUsageInfo
@@ -400,7 +400,9 @@ func (v bucketInfoMessage) String() string {
keyStr = strings.TrimSuffix(keyStr, slashSeperator)
key := fmt.Sprintf("%-10s: %s", "Name", keyStr)
b.WriteString(console.Colorize("Title", key) + "\n")
b.WriteString(fmt.Sprintf("%-10s: %s ", "Date", v.Date.Format(printDate)) + "\n")
if !v.Date.IsZero() && !v.Date.Equal(timeSentinel) {
b.WriteString(fmt.Sprintf("%-10s: %s ", "Date", v.Date.Format(printDate)) + "\n")
}
b.WriteString(fmt.Sprintf("%-10s: %-6s \n", "Size", humanize.IBytes(uint64(v.Size))))
fType := func() string {