Show last update check time in local timezone

admin-dashboard-redesign
Matt Baer 5 years ago
parent 68e992a55e
commit 48ca695c46
  1. 2
      admin.go
  2. 9
      templates/user/admin/app-updates.tmpl

@ -584,6 +584,7 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re
p := struct {
*UserPage
LastChecked string
LastChecked8601 string
LatestVersion string
LatestReleaseNotesURL string
UpdateAvailable bool
@ -592,6 +593,7 @@ func handleViewAdminUpdates(app *App, u *User, w http.ResponseWriter, r *http.Re
}
if app.cfg.App.UpdateChecks {
p.LastChecked = app.updates.lastCheck.Format("January 2, 2006, 3:04 PM")
p.LastChecked8601 = app.updates.lastCheck.Format("2006-01-02T15:04:05Z")
p.LatestVersion = app.updates.LatestVersion()
p.LatestReleaseNotesURL = app.updates.ReleaseNotesURL()
p.UpdateAvailable = app.updates.AreAvailable()

@ -15,7 +15,14 @@
For details on features, bug fixes or notes on upgrading, <a href="{{.LatestReleaseNotesURL}}">read the release notes</a>.
</section>
{{end}}
<p>Last checked at: {{.LastChecked}}. <a href="/admin/updates?check=now">Check now</a>.</p>
<p>Last checked at: <time class="dt-published" datetime="{{.LastChecked8601}}">{{.LastChecked}}</time>. <a href="/admin/updates?check=now">Check now</a>.</p>
<script>
// Code modified from /js/localdate.js
var displayEl = document.querySelector("time");
var d = new Date(displayEl.getAttribute("datetime"));
displayEl.textContent = d.toLocaleDateString(navigator.language || "en-US", { dateStyle: 'long', timeStyle: 'short' });
</script>
{{template "footer" .}}

Loading…
Cancel
Save