solar/pssolar: Reject -T arguments that aren't d/c/n/a letters - #9222
Merged
Merged
Conversation
-T's date must be given as +d<date> (-Tdcna[+d<date>][+z<TZ>]). If the +d is forgotten and a date is glued directly after the type letters (e.g. -Td2020-01-01T00:00:00, instead of -Td+d2020-01-01T00:00:00), the leftover text was silently scanned for d/c/n/a and otherwise ignored: no error, and pssolar_params() falls back to using today's real date instead of the one the user typed, since Ctrl->T.calendar was never populated. Found while investigating gh#9220: that issue's own reproduction script has this exact typo, so it (and this session's own test scripts) never actually plotted 2020-01-01 - only "now". This didn't invalidate the TZ-offset comparison itself (still a fair comparison at whatever instant the command ran), but it means -T's +d has likely never worked as documented for anyone who made the same easy mistake. Add a self-checking test that fails on the old (missing-+d) behavior and confirms +d is honored (Jan vs June terminators differ). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
joa-quim
approved these changes
Sep 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
-T's date must be given with the+dprefix:-Tdcna[+d<date>][+z<TZ>]. If+dis forgotten and a date is glued directly after the type letters (e.g.-Td2020-01-01T00:00:00instead of-Td+d2020-01-01T00:00:00), GMT doesn't error - it silently ignores the leftover text and plots today's date instead of the one requested.Found while investigating gh#9220: that issue's own reproduction script has this exact typo, so it never actually pinned the date to 2020-01-01 (it always plotted "now" - the TZ-offset comparison in that issue is still valid regardless, since it doesn't depend on which day it runs). This same mistake is easy to make since, unlike
-I, thedright after-Tis the terminator-type selector, not the start of the date.This PR makes
-Treject any character in its argument that isn'td,c,n, ora, so this typo now produces a clear parse error instead of silently plotting the wrong day.Reproduction
December 21 and June 21 are six months apart (opposite solstices) and should produce near-mirrored terminators, but both silently plot "now" instead, so the two lines land exactly on top of each other (screenshot attached separately to the requester).
Reminders
🤖 Generated with Claude Code