Commit 3de8c0c
Fix sun_rise_set_transit_spa day-of-interest to local calendar day
sun_rise_set_transit_spa normalized timestamps to midnight *after*
converting to UTC (introduced in v0.11.1 by #2055). An evening-local
timestamp is the next calendar day in UTC, so its day of interest was
shifted forward and the function returned the following day's
sunrise, sunset, and transit.
Use the input's local calendar date as the day of interest, restoring
the pre-v0.11.1 behavior. The SPA routine requires 00:00 UTC input, so
the local date is re-labeled (not converted) to UTC. The timezone label
is stripped before normalize() so truncation runs on a naive index:
normalizing a tz-aware index would build local midnight, which does not
exist (spring-forward) or is ambiguous (fall-back) on DST-transition
days and would raise. This yields unixtimes byte-for-byte identical to
the v0.11.0 implementation for all valid inputs. Adds an inline comment
explaining the timezone handling (requested in the issue) and a
regression test covering negative and positive offsets and a
midnight-DST zone.
Fixes #2238
This change was drafted with AI assistance (Claude); all AI-generated
material has been vetted for accuracy and is license-compliant.
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9a0ad55 commit 3de8c0c
3 files changed
Lines changed: 74 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| |||
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| 62 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
450 | 449 | | |
451 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
452 | 465 | | |
453 | 466 | | |
454 | 467 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
186 | 239 | | |
187 | 240 | | |
188 | 241 | | |
| |||
0 commit comments