Commit f559657
fix(waterdata): resolve naive datetime filters per-date, not at today's offset
_format_api_dates froze `datetime.now().astimezone().tzinfo` (today's UTC
offset) and applied it to every naive datetime input. A naive input on a date
whose DST status differs from today was shifted by an hour: on an EDT (-0400)
machine, time="2020-01-01 12:00:00" produced 2020-01-01T16:00:00Z, but January
is EST (-0500) so the correct value is 17:00:00Z. This skewed the query window
for get_continuous / get_field_measurements (time/begin/end) across DST
boundaries.
Use `parsed.astimezone()` to interpret a naive input in the system local zone
with the DST rules for its own date, then convert to UTC. Inputs that already
carry an explicit offset are unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ee653e5 commit f559657
1 file changed
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
| |||
317 | 321 | | |
318 | 322 | | |
319 | 323 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 324 | + | |
| 325 | + | |
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
| |||
0 commit comments