From 57f3998a88f173c181ef8bba1d768d9615e73e2d Mon Sep 17 00:00:00 2001 From: Igor Shishkin Date: Tue, 21 May 2024 13:14:42 +0300 Subject: [PATCH] Use proper timezone in the timestamp received from barman-cloud-backup-list Signed-off-by: Igor Shishkin --- pkg/management/catalog/catalog.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/management/catalog/catalog.go b/pkg/management/catalog/catalog.go index f9837865e3..be46e772cf 100644 --- a/pkg/management/catalog/catalog.go +++ b/pkg/management/catalog/catalog.go @@ -282,19 +282,20 @@ func (b *BarmanBackup) deserializeBackupTimeStrings() error { barmanTimeLayout = "Mon Jan 2 15:04:05 2006" ) - var err error if b.BeginTimeString != "" { - b.BeginTime, err = time.Parse(barmanTimeLayout, b.BeginTimeString) + ts, err := time.Parse(barmanTimeLayout, b.BeginTimeString) if err != nil { return err } + b.BeginTime = time.Date(ts.Year(), ts.Month(), ts.Day(), ts.Hour(), ts.Minute(), ts.Second(), ts.Nanosecond(), time.Local) } if b.EndTimeString != "" { - b.EndTime, err = time.Parse(barmanTimeLayout, b.EndTimeString) + ts, err := time.Parse(barmanTimeLayout, b.EndTimeString) if err != nil { return err } + b.EndTime = time.Date(ts.Year(), ts.Month(), ts.Day(), ts.Hour(), ts.Minute(), ts.Second(), ts.Nanosecond(), time.Local) } return nil