0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-25 17:04:12 -05:00

parse milestone.deadline as local time

This commit is contained in:
Tobias Kunicke 2016-02-06 00:10:32 +01:00
parent fa5a1cb54f
commit bc0eee48d5

View file

@ -1079,7 +1079,7 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
if len(form.Deadline) == 0 { if len(form.Deadline) == 0 {
form.Deadline = "9999-12-31" form.Deadline = "9999-12-31"
} }
deadline, err := time.Parse("2006-01-02", form.Deadline) deadline, err := time.ParseInLocation("2006-01-02", form.Deadline, time.Local)
if err != nil { if err != nil {
ctx.Data["Err_Deadline"] = true ctx.Data["Err_Deadline"] = true
ctx.RenderWithErr(ctx.Tr("repo.milestones.invalid_due_date_format"), MILESTONE_NEW, &form) ctx.RenderWithErr(ctx.Tr("repo.milestones.invalid_due_date_format"), MILESTONE_NEW, &form)
@ -1139,7 +1139,7 @@ func EditMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) {
if len(form.Deadline) == 0 { if len(form.Deadline) == 0 {
form.Deadline = "9999-12-31" form.Deadline = "9999-12-31"
} }
deadline, err := time.Parse("2006-01-02", form.Deadline) deadline, err := time.ParseInLocation("2006-01-02", form.Deadline, time.Local)
if err != nil { if err != nil {
ctx.Data["Err_Deadline"] = true ctx.Data["Err_Deadline"] = true
ctx.RenderWithErr(ctx.Tr("repo.milestones.invalid_due_date_format"), MILESTONE_NEW, &form) ctx.RenderWithErr(ctx.Tr("repo.milestones.invalid_due_date_format"), MILESTONE_NEW, &form)