-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix high/low temp for 'today' period #1319
Conversation
-- What Greg highlighted a simpler way to determine whether or not to only show the low temperature: if there is only 1 'today' period, then it is a night/overnight period and thus should only show the low. Therefore we can remove the more complicated time calc function, since we already have the information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a hacky problem. Nice solution!
$now = \DateTimeImmutable::createFromFormat( | ||
\DateTimeInterface::ISO8601_EXPANDED, | ||
"2024-05-07T18:01:00-0500", | ||
); | ||
|
||
$this->onLocationRoute(32.778, -96.796); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to think about this for a minute, but I get it now. Based on how the useOnlyLowForToday
flag gets sets below, I was thinking the only thing that mattered was how the data was returned from the API, but then I remembered that we subdivide the daily forecast periods into days based on the current time and the times of the periods.
What does this PR do? 🛠️
With #1153 we noticed that the 7-day's "today" forecast card, when it's after 6pm, still displayed both the high and low temperatures. We decided that after 6pm and through the "overnight" period, we should only show the low temperature.
This PR implements the change, along with a test.
What does the reviewer need to know? 🤔
It can be hard to visually test this, since we don't have full control of time (ahem, ahem). In the screenshot below, I was able to confirm this is working by checking the weather in Guam at 9:30AM New York time, which is 11:30PM Guam time, and therefore meets the criteria for only showing the low temp.
Shouts to @greg-does-weather for highlighting a simpler way to do this than I originally came up with
Screenshots (if appropriate): 📸