mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 00:38:36 +00:00
Display ui time with customize time location (#7792)
* display ui time with customize time location * fix lint * rename UILocation to DefaultUILocation * move time related functions to modules/timeutil * fix tests * fix tests * fix build * fix swagger
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/process"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
@@ -32,13 +32,13 @@ type Release struct {
|
||||
Title string
|
||||
Sha1 string `xorm:"VARCHAR(40)"`
|
||||
NumCommits int64
|
||||
NumCommitsBehind int64 `xorm:"-"`
|
||||
Note string `xorm:"TEXT"`
|
||||
IsDraft bool `xorm:"NOT NULL DEFAULT false"`
|
||||
IsPrerelease bool `xorm:"NOT NULL DEFAULT false"`
|
||||
IsTag bool `xorm:"NOT NULL DEFAULT false"`
|
||||
Attachments []*Attachment `xorm:"-"`
|
||||
CreatedUnix util.TimeStamp `xorm:"INDEX"`
|
||||
NumCommitsBehind int64 `xorm:"-"`
|
||||
Note string `xorm:"TEXT"`
|
||||
IsDraft bool `xorm:"NOT NULL DEFAULT false"`
|
||||
IsPrerelease bool `xorm:"NOT NULL DEFAULT false"`
|
||||
IsTag bool `xorm:"NOT NULL DEFAULT false"`
|
||||
Attachments []*Attachment `xorm:"-"`
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX"`
|
||||
}
|
||||
|
||||
func (r *Release) loadAttributes(e Engine) error {
|
||||
@@ -137,13 +137,13 @@ func createTag(gitRepo *git.Repository, rel *Release) error {
|
||||
}
|
||||
|
||||
rel.Sha1 = commit.ID.String()
|
||||
rel.CreatedUnix = util.TimeStamp(commit.Author.When.Unix())
|
||||
rel.CreatedUnix = timeutil.TimeStamp(commit.Author.When.Unix())
|
||||
rel.NumCommits, err = commit.CommitsCount()
|
||||
if err != nil {
|
||||
return fmt.Errorf("CommitsCount: %v", err)
|
||||
}
|
||||
} else {
|
||||
rel.CreatedUnix = util.TimeStampNow()
|
||||
rel.CreatedUnix = timeutil.TimeStampNow()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user