Commit 1adf174
fix(waterdata): resolve naive datetime filters per-date, not at today's offset (#307)
_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 665383f commit 1adf174
1 file changed
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
246 | 250 | | |
247 | 251 | | |
248 | 252 | | |
| |||
327 | 331 | | |
328 | 332 | | |
329 | 333 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 334 | + | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
0 commit comments