mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-21 09:57:14 -04:00
[PORT] Replace DateTime with proper functions (gitea#32402)
Follow https://github.com/go-gitea/gitea/pull/32383 This PR cleans up the "Deadline" usages in templates, make them call `ParseLegacy` first to get a `Time` struct then display by `DateUtils`. Now it should be pretty clear how "deadline string" works, it makes it possible to do further refactoring and correcting. (cherry picked from commit 259811617ba15c77ddd89360178a59251d611af2)
This commit is contained in:
parent
f2eabf6308
commit
fddde93759
9 changed files with 60 additions and 36 deletions
|
@ -52,7 +52,7 @@ func NewFuncMap() template.FuncMap {
|
|||
"StringUtils": NewStringUtils,
|
||||
"SliceUtils": NewSliceUtils,
|
||||
"JsonUtils": NewJsonUtils,
|
||||
"DateUtils": NewDateUtils, // TODO: to be replaced by DateUtils
|
||||
"DateUtils": NewDateUtils,
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// svg / avatar / icon / color
|
||||
|
@ -69,7 +69,7 @@ func NewFuncMap() template.FuncMap {
|
|||
"CountFmt": base.FormatNumberSI,
|
||||
"TimeSince": timeutil.TimeSince,
|
||||
"TimeSinceUnix": timeutil.TimeSinceUnix,
|
||||
"DateTime": timeutil.DateTime,
|
||||
"DateTime": dateTimeLegacy, // for backward compatibility only, do not use it anymore
|
||||
"Sec2Time": util.SecToTime,
|
||||
"LoadTimes": func(startTime time.Time) string {
|
||||
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue