diff --git a/webapi/formatting.go b/webapi/formatting.go index 1cbe120a..b3489c8e 100644 --- a/webapi/formatting.go +++ b/webapi/formatting.go @@ -1,5 +1,7 @@ package webapi +import "time" + func addressURL(blockExplorerURL string) func(string) string { return func(addr string) string { return blockExplorerURL + "/address/" + addr @@ -11,3 +13,7 @@ func txURL(blockExplorerURL string) func(string) string { return blockExplorerURL + "/tx/" + txID } } + +func dateTime(t int64) string { + return time.Unix(t, 0).Format("2 Jan 2006 15:04:05") +} diff --git a/webapi/homepage.go b/webapi/homepage.go index b3168f00..626f82b8 100644 --- a/webapi/homepage.go +++ b/webapi/homepage.go @@ -55,7 +55,7 @@ func updateVSPStats(db *database.VspDatabase, cfg Config) error { Revoked: revoked, VSPFee: cfg.VSPFee, Network: cfg.NetParams.Name, - UpdateTime: time.Now().Format("Mon Jan _2 15:04:05 2006"), + UpdateTime: dateTime(time.Now().Unix()), SupportEmail: cfg.SupportEmail, VspClosed: cfg.VspClosed, Debug: cfg.Debug, diff --git a/webapi/templates/admin.html b/webapi/templates/admin.html index 35da78d9..d7f71915 100644 --- a/webapi/templates/admin.html +++ b/webapi/templates/admin.html @@ -125,7 +125,7 @@

Search Result

Fee Expiration - {{ .Ticket.FeeExpiration }} + {{ .Ticket.FeeExpiration }} ({{ dateTime .Ticket.FeeExpiration }}) Confirmed diff --git a/webapi/webapi.go b/webapi/webapi.go index 8e716096..9aecd3b0 100644 --- a/webapi/webapi.go +++ b/webapi/webapi.go @@ -179,8 +179,8 @@ func router(debugMode bool, cookieSecret []byte, dcrd rpc.DcrdConnect, wallets r // Add custom functions for use in templates. router.SetFuncMap(template.FuncMap{ "txURL": txURL(cfg.BlockExplorerURL), - "blockURL": blockURL(cfg.BlockExplorerURL), "addressURL": addressURL(cfg.BlockExplorerURL), + "dateTime": dateTime, }) router.LoadHTMLGlob("webapi/templates/*.html")