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

Skips Tomorrow in Forecast #27

Open
AllenM001 opened this issue May 9, 2024 · 3 comments
Open

Skips Tomorrow in Forecast #27

AllenM001 opened this issue May 9, 2024 · 3 comments

Comments

@AllenM001
Copy link

The day for today is taken from the first 3 hour forecast. If it is after 9:00pm it will return tomorrows day instead of today. strDate() should be used instead. In the section "Get 3 hourly index at start of next day" replace this:
String today = forecast->dt_txt[0].substring(8, 10);
with this:
String today = strDate(now()).substring(4, 6);

@AllenM001
Copy link
Author

Sorry, I posted this prematurely. It fixes the late night time problem but screws up the daytime display. (??)

@AllenM001
Copy link
Author

strDate() does not add a leading zero.

@AllenM001
Copy link
Author

In getNextDayIndex() you must compare integers rather than strings:

if (forecast->dt_txt[index].substring(8, 10).toInt() != today.toInt()) break;

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

No branches or pull requests

1 participant