comparison pkg/controllers/bottlenecks.go @ 3373:27aca46771b5

Waterlevel calculation: fixed labels of quarters (again).
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 22 May 2019 13:14:55 +0200
parents ea49febfbc60
children 7d8c41cc50f5
comparison
equal deleted inserted replaced
3372:ea49febfbc60 3373:27aca46771b5
685 if pfrom.After(to) { 685 if pfrom.After(to) {
686 return time.Time{}, time.Time{}, "" 686 return time.Time{}, time.Time{}, ""
687 } 687 }
688 f := pfrom 688 f := pfrom
689 pfrom = pfrom.AddDate(0, 3, 0) 689 pfrom = pfrom.AddDate(0, 3, 0)
690 label := fmt.Sprintf("Q%d-%d", 1+int(f.Month()+1)/4, f.Year()) 690 label := fmt.Sprintf("Q%d-%d", (int(f.Month())-1)/3+1, f.Year())
691 return f, f.AddDate(0, 3, 0).Add(-time.Nanosecond), label 691 return f, f.AddDate(0, 3, 0).Add(-time.Nanosecond), label
692 } 692 }
693 } 693 }
694 694
695 func yearly(from, to time.Time) func() (time.Time, time.Time, string) { 695 func yearly(from, to time.Time) func() (time.Time, time.Time, string) {