diff --git a/date_utils/date_utils.go b/date_utils/date_utils.go index e456d7977992d96d2a3ac13c2525f9861e6afb61..d60b7c8255b1bc500c9585f41a32a93e0259839e 100644 --- a/date_utils/date_utils.go +++ b/date_utils/date_utils.go @@ -8,6 +8,8 @@ import ( const TimeZoneString = "Africa/Johannesburg" +var currentLocation *time.Location + func DateLayoutYearMonthDayTimeT() string { layout := "2006-01-02T15:04:05" return layout @@ -81,8 +83,10 @@ func DateDBFormattedStringDateOnly(date time.Time) string { } func CurrentLocation() *time.Location { - loc, _ := time.LoadLocation(TimeZoneString) - return loc + if currentLocation == nil { + currentLocation, _ = time.LoadLocation(TimeZoneString) + } + return currentLocation } func DateLocal(date *time.Time) {