Skip to content

Fix forecast query key bug#1164

Merged
stevekuznetsov merged 2 commits intoNWACus:mainfrom
kevinherdez:kevinherdez/forecastQueryFix
Apr 3, 2026
Merged

Fix forecast query key bug#1164
stevekuznetsov merged 2 commits intoNWACus:mainfrom
kevinherdez:kevinherdez/forecastQueryFix

Conversation

@kevinherdez
Copy link
Copy Markdown
Collaborator

We do not correctly calculate the nominalDate that we attach to the query key for the useAvalancheForecast call. The issue was that we were incorrectly assuming that the expires_time field returned in the avalanche center metadata was an integer. However, there are at least 3 centers that return a float to specify that the forecasts expired on the half hour. For example, NWAC's expires time is 18.5.

We were creating a timestamp using the time passed in as the hour so the expires time for 18.5 was 18.5:00:00 instead of 18:30:00. The invalid time was being changed to 00:00:00 and leading to an incorrect nominal date because requestedTime was guaranteed to be before expiresTime.

I created a helper function that correctly creates the string and added tests

@stevekuznetsov stevekuznetsov added this pull request to the merge queue Apr 3, 2026
Merged via the queue into NWACus:main with commit 8ee9845 Apr 3, 2026
5 checks passed
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