mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 10:04:27 +00:00
* Fix timezone on issue deadline
* FormatDate
Co-authored-by: zeripath <art27@cantab.net>
(cherry picked from commit bbe13b60cd
)
This commit is contained in:
parent
921a5c0b62
commit
287e2c781b
@ -75,6 +75,11 @@ func (ts TimeStamp) FormatShort() string {
|
|||||||
return ts.Format("Jan 02, 2006")
|
return ts.Format("Jan 02, 2006")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FormatDate formats a date in YYYY-MM-DD server time zone
|
||||||
|
func (ts TimeStamp) FormatDate() string {
|
||||||
|
return time.Unix(int64(ts), 0).String()[:10]
|
||||||
|
}
|
||||||
|
|
||||||
// IsZero is zero time
|
// IsZero is zero time
|
||||||
func (ts TimeStamp) IsZero() bool {
|
func (ts TimeStamp) IsZero() bool {
|
||||||
return ts.AsTimeInLocation(time.Local).IsZero()
|
return ts.AsTimeInLocation(time.Local).IsZero()
|
||||||
|
@ -691,7 +691,7 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
|
|||||||
var deadline time.Time
|
var deadline time.Time
|
||||||
if form.Deadline != nil && !form.Deadline.IsZero() {
|
if form.Deadline != nil && !form.Deadline.IsZero() {
|
||||||
deadline = time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
|
deadline = time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(),
|
||||||
23, 59, 59, 0, form.Deadline.Location())
|
23, 59, 59, 0, time.Local)
|
||||||
deadlineUnix = timeutil.TimeStamp(deadline.Unix())
|
deadlineUnix = timeutil.TimeStamp(deadline.Unix())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@
|
|||||||
{{if ne .Issue.DeadlineUnix 0}}
|
{{if ne .Issue.DeadlineUnix 0}}
|
||||||
<p>
|
<p>
|
||||||
{{svg "octicon-calendar" 16}}
|
{{svg "octicon-calendar" 16}}
|
||||||
{{.Issue.DeadlineUnix.FormatShort}}
|
{{.Issue.DeadlineUnix.FormatDate}}
|
||||||
{{if .Issue.IsOverdue}}
|
{{if .Issue.IsOverdue}}
|
||||||
<span style="color: red;">{{.i18n.Tr "repo.issues.due_date_overdue"}}</span>
|
<span style="color: red;">{{.i18n.Tr "repo.issues.due_date_overdue"}}</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
Reference in New Issue
Block a user