summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/issue.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-15 22:46:21 +0800
committerGitHub <noreply@github.com>2019-08-15 22:46:21 +0800
commit85202d4784758573f80f93dbbda97a444e7ece99 (patch)
tree7957506de8657463e79f121e1b79567ef1cc84a1 /routers/api/v1/repo/issue.go
parent5a44be627c055d3e9eb406ec4a91579de78b6910 (diff)
downloadgitea-85202d4784758573f80f93dbbda97a444e7ece99.tar.gz
gitea-85202d4784758573f80f93dbbda97a444e7ece99.zip
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
Diffstat (limited to 'routers/api/v1/repo/issue.go')
-rw-r--r--routers/api/v1/repo/issue.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index daaa3d5985..8595be335b 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -16,6 +16,7 @@ import (
issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
api "code.gitea.io/gitea/modules/structs"
@@ -183,9 +184,9 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
// "201":
// "$ref": "#/responses/Issue"
- var deadlineUnix util.TimeStamp
+ var deadlineUnix timeutil.TimeStamp
if form.Deadline != nil && ctx.Repo.CanWrite(models.UnitTypeIssues) {
- deadlineUnix = util.TimeStamp(form.Deadline.Unix())
+ deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix())
}
issue := &models.Issue{
@@ -310,9 +311,9 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
}
// Update the deadline
- var deadlineUnix util.TimeStamp
+ var deadlineUnix timeutil.TimeStamp
if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.CanWrite(models.UnitTypeIssues) {
- deadlineUnix = util.TimeStamp(form.Deadline.Unix())
+ deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix())
}
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {
@@ -430,12 +431,12 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
return
}
- var deadlineUnix util.TimeStamp
+ var deadlineUnix timeutil.TimeStamp
var deadline time.Time
if form.Deadline != nil && !form.Deadline.IsZero() {
deadline = time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
23, 59, 59, 0, form.Deadline.Location())
- deadlineUnix = util.TimeStamp(deadline.Unix())
+ deadlineUnix = timeutil.TimeStamp(deadline.Unix())
}
if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil {