update constant

This commit is contained in:
Nam Huynh 2021-08-09 11:44:33 +07:00
parent 61c80de59d
commit dc7fa0ba79
2 changed files with 6 additions and 6 deletions

View File

@ -38,7 +38,7 @@ func (s Service) Create(payload CreatePayload) {
ID: payload.Author.ID,
Name: payload.Author.Name,
},
CreatedAt: Now(),
CreatedAt: now(),
}
// Insert to db

10
time.go
View File

@ -10,13 +10,13 @@ import "time"
const timezoneHCM = "Asia/Ho_Chi_Minh"
// GetHCMLocation ...
func GetHCMLocation() *time.Location {
// getHCMLocation ...
func getHCMLocation() *time.Location {
l, _ := time.LoadLocation(timezoneHCM)
return l
}
// Now ...
func Now() time.Time {
return time.Now().In(GetHCMLocation())
// now ...
func now() time.Time {
return time.Now().In(getHCMLocation())
}