mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Refactor timeutil package (#28623)
1. make names more readable 2. remove unused FormatLong/FormatShort 3. use `FormatDate` instead of `Format "2006-01-02"`
This commit is contained in:
@ -899,15 +899,15 @@ func createDeadlineComment(ctx context.Context, doer *user_model.User, issue *Is
|
||||
// newDeadline = 0 means deleting
|
||||
if newDeadlineUnix == 0 {
|
||||
commentType = CommentTypeRemovedDeadline
|
||||
content = issue.DeadlineUnix.Format("2006-01-02")
|
||||
content = issue.DeadlineUnix.FormatDate()
|
||||
} else if issue.DeadlineUnix == 0 {
|
||||
// Check if the new date was added or modified
|
||||
// If the actual deadline is 0 => deadline added
|
||||
commentType = CommentTypeAddedDeadline
|
||||
content = newDeadlineUnix.Format("2006-01-02")
|
||||
content = newDeadlineUnix.FormatDate()
|
||||
} else { // Otherwise modified
|
||||
commentType = CommentTypeModifiedDeadline
|
||||
content = newDeadlineUnix.Format("2006-01-02") + "|" + issue.DeadlineUnix.Format("2006-01-02")
|
||||
content = newDeadlineUnix.FormatDate() + "|" + issue.DeadlineUnix.FormatDate()
|
||||
}
|
||||
|
||||
if err := issue.LoadRepo(ctx); err != nil {
|
||||
|
@ -86,7 +86,7 @@ func (m *Milestone) AfterLoad() {
|
||||
return
|
||||
}
|
||||
|
||||
m.DeadlineString = m.DeadlineUnix.Format("2006-01-02")
|
||||
m.DeadlineString = m.DeadlineUnix.FormatDate()
|
||||
if m.IsClosed {
|
||||
m.IsOverdue = m.ClosedDateUnix >= m.DeadlineUnix
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user