truncateMidnight truncates a time to midnight in the time object's timezone. t.Truncate(24 * time.Hour) truncates based on the internal time and doesn't factor daylight savings properly. See: https://github.com/golang/go/issues/10894
(t time.Time)
| 277 | // |
| 278 | // See: https://github.com/golang/go/issues/10894 |
| 279 | func truncateMidnight(t time.Time) time.Time { |
| 280 | yy, mm, dd := t.Date() |
| 281 | return time.Date(yy, mm, dd, 0, 0, 0, 0, t.Location()) |
| 282 | } |
| 283 | |
| 284 | // nextDayMidnight returns the next midnight in the time object's timezone. |
| 285 | func nextDayMidnight(t time.Time) time.Time { |
no test coverage detected