Skip to content

Commit

Permalink
fix: Use ISO 8601 date format (#4141)
Browse files Browse the repository at this point in the history
Co-authored-by: Luke Massa <lmassa@tripadvisor.com>
  • Loading branch information
jdmulloy and lukemassa authored May 1, 2024
1 parent 603fb26 commit 93578d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions server/controllers/web_templates/web_templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func TestIndexTemplate(t *testing.T) {
Path: "path",
Workspace: "workspace",
Time: time.Now(),
TimeFormatted: "02-01-2006 15:04:05",
TimeFormatted: "2006-01-02 15:04:05",
},
},
ApplyLock: ApplyLockData{
Locked: true,
Time: time.Now(),
TimeFormatted: "02-01-2006 15:04:05",
TimeFormatted: "2006-01-02 15:04:05",
},
AtlantisVersion: "v0.0.0",
CleanedBasePath: "/path",
Expand Down
6 changes: 3 additions & 3 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ func (s *Server) Index(w http.ResponseWriter, _ *http.Request) {
Path: v.Project.Path,
Workspace: v.Workspace,
Time: v.Time,
TimeFormatted: v.Time.Format("02-01-2006 15:04:05"),
TimeFormatted: v.Time.Format("2006-01-02 15:04:05"),
})
}

Expand All @@ -1097,7 +1097,7 @@ func (s *Server) Index(w http.ResponseWriter, _ *http.Request) {
Time: applyCmdLock.Time,
Locked: applyCmdLock.Locked,
GlobalApplyLockEnabled: applyCmdLock.GlobalApplyLockEnabled,
TimeFormatted: applyCmdLock.Time.Format("02-01-2006 15:04:05"),
TimeFormatted: applyCmdLock.Time.Format("2006-01-02 15:04:05"),
}
//Sort by date - newest to oldest.
sort.SliceStable(lockResults, func(i, j int) bool { return lockResults[i].Time.After(lockResults[j].Time) })
Expand All @@ -1122,7 +1122,7 @@ func preparePullToJobMappings(s *Server) []jobs.PullInfoWithJobIDs {
for j := range pullToJobMappings[i].JobIDInfos {
jobUrl, _ := s.Router.Get(ProjectJobsViewRouteName).URL("job-id", pullToJobMappings[i].JobIDInfos[j].JobID)
pullToJobMappings[i].JobIDInfos[j].JobIDUrl = jobUrl.String()
pullToJobMappings[i].JobIDInfos[j].TimeFormatted = pullToJobMappings[i].JobIDInfos[j].Time.Format("02-01-2006 15:04:05")
pullToJobMappings[i].JobIDInfos[j].TimeFormatted = pullToJobMappings[i].JobIDInfos[j].Time.Format("2006-01-02 15:04:05")
}

//Sort by date - newest to oldest.
Expand Down
4 changes: 2 additions & 2 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ func TestIndex_Success(t *testing.T) {
ApplyLock: web_templates.ApplyLockData{
Locked: false,
Time: time.Time{},
TimeFormatted: "01-01-0001 00:00:00",
TimeFormatted: "0001-01-01 00:00:00",
},
Locks: []web_templates.LockIndexData{
{
LockPath: "/lock?id=lkysow%252Fatlantis-example%252F.%252Fdefault",
RepoFullName: "lkysow/atlantis-example",
PullNum: 9,
Time: now,
TimeFormatted: now.Format("02-01-2006 15:04:05"),
TimeFormatted: now.Format("2006-01-02 15:04:05"),
},
},
PullToJobMapping: []jobs.PullInfoWithJobIDs{},
Expand Down

0 comments on commit 93578d8

Please sign in to comment.