Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use ISO 8601 date format #4141

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading