Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timezone on issue deadline #11697

Merged
merged 3 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FormatDate
  • Loading branch information
CirnoT committed May 30, 2020
commit 8756e9d13d98369e102c5a061416ad826692e9d8
5 changes: 5 additions & 0 deletions modules/timeutil/timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ func (ts TimeStamp) FormatShort() string {
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
func (ts TimeStamp) IsZero() bool {
return ts.AsTimeInLocation(time.Local).IsZero()
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/issue/view_content/sidebar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

{{range $.PullReviewers}}
{{if eq .ReviewerID $ReviewerID }}
{{$notReviewed = false }}
{{$notReviewed = false }}
{{if eq .Type 4 }}
{{$checked = true}}
{{if or (eq $ReviewerID $.SignedUserID) $.Permission.IsAdmin}}
Expand Down Expand Up @@ -357,7 +357,7 @@
{{if ne .Issue.DeadlineUnix 0}}
<p>
{{svg "octicon-calendar" 16}}
{{.Issue.DeadlineUnix.FormatShort}}
{{.Issue.DeadlineUnix.FormatDate}}
{{if .Issue.IsOverdue}}
<span style="color: red;">{{.i18n.Tr "repo.issues.due_date_overdue"}}</span>
{{end}}
Expand Down