Incorrect date when using my Geonames API username (correct when not using a Geonames API username)

Created on 23 May 2025, 16 days ago

Problem/Motivation

When I use the Weather module with my Geonames API username the date and weather shown is for three days in the future 72 hours away. For example, in my case, the time difference between now (May 23, 2025 09:20) and 04:00-05:00 on May 26, 2025 is 3 days, 1 hour.

Steps to reproduce

Create clean Drupal 10 site, install Weather (DEV release and apply the patch to update the Autocomplete controller to use Symfony\Component\HttpFoundation\RequestStack).

Use with a Google Geocoding certificate but leave the Geonames API username blank.

Create a display and add a place that you would like to see weather for and place the block on a page. Everything should look more or less normal with a readable forecast however, it will show weather for GMT on the current date.

Go to Weather settings and add the Geonames API username that you created according to the Readme.md and return to view the block. The weather will be shown several days in the future.

Proposed resolution

Not sure. It may be an issue with the way the Geonames API sets up the account and we need to add some documentation or it might be some quirk in the code. Will require some discussion.

Remaining tasks

Discussion to fix.

User interface changes

Unknown

API changes

Unknown

Data model changes

Unknown

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇨🇦Canada awasson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @awasson
  • 🇨🇦Canada awasson

    It appears that once the Weather module uses a valid Geonames API username, there is no way in the short term to get back to using no Geonames API username and it seems to be stuck on providing a forecast 72 hours in the future. I am still investigating how forecast.formatted_date is derived.

  • 🇨🇦Canada awasson

    I found a method of removing the Geonames API username and reseting it to use whatever default username it uses. I went to Extend -> Uninstall Module and removed all of the entities that had been created without uninstalling the weather module. Then I navigated to the UI Settings for Weather. I made certain that it was not using a Geonames API Username. I created a new display, added a place and then placed it in Structure -> Blocks -> Block Layout. Now I get the forecast for today GMT.

Production build 0.71.5 2024