Skip to content
Snippets Groups Projects

Resolve "Store current location so that it is not loaded from disk each time"

1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
+ 6
2
@@ -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) {
Loading