Commit 0e760eb
fix(jobs): compare the escalation and reminder cut-offs in UTC
created_at holds UTC — ClockService::now() is deliberately UTC, because
a timestamp records an instant rather than a day. The escalation and
reminder jobs, equally deliberately, work their cut-offs out on the
server's calendar: which day a request falls on is a company question.
Formatting such a cut-off straight into the query wrote its local
wall-clock and silently shifted every bound by the server's UTC offset.
Escalation only slipped by hours, but the reminder band is exactly one
working day wide, so off Berlin's or Auckland's offset it reminded a
cohort a day early or skipped it altogether.
Converted in the mapper, which is the layer that knows what the column
holds, so both queries are covered at once. Rebuilt from the timestamp
rather than via setTimezone() so a caller's mutable DateTime is never
altered underneath it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 8f26e2b commit 0e760eb
1 file changed
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
108 | 128 | | |
109 | 129 | | |
110 | 130 | | |
| |||
117 | 137 | | |
118 | 138 | | |
119 | 139 | | |
120 | | - | |
| 140 | + | |
121 | 141 | | |
122 | 142 | | |
123 | 143 | | |
| |||
170 | 190 | | |
171 | 191 | | |
172 | 192 | | |
173 | | - | |
174 | | - | |
| 193 | + | |
| 194 | + | |
175 | 195 | | |
176 | 196 | | |
177 | 197 | | |
| |||
0 commit comments