Skip to content
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

Merged
merged 5 commits into from
Jun 17, 2024
Merged

Conversation

eric-gade
Copy link
Collaborator

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): 📸

Screenshot 2024-06-13 at 9 53 21 AM

-- 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.
Copy link
Collaborator

@greg-does-weather greg-does-weather left a 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!

Comment on lines +272 to +277
$now = \DateTimeImmutable::createFromFormat(
\DateTimeInterface::ISO8601_EXPANDED,
"2024-05-07T18:01:00-0500",
);

$this->onLocationRoute(32.778, -96.796);
Copy link
Collaborator

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.

https://github.com/weather-gov/weather.gov/pull/1319/files#diff-3cf5ed10dc8559478c4d8c2552ad2691ced84edeb99636aa49fdeebdacec014cR262

@eric-gade eric-gade enabled auto-merge June 17, 2024 15:16
@eric-gade eric-gade merged commit 7ae47fb into main Jun 17, 2024
12 of 13 checks passed
@eric-gade eric-gade deleted the eg-1153-high-low-temp-issue branch June 17, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants