Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'd like to display sunrise and sunset times in local time (using drupal's standard timezone, or even user specific tz) instead of GMT. Would be great if this can be added to the weather module. Thanks in advance! (BTW: great module!)
Comments
Comment #1
jdtart CreditAttribution: jdtart commentedI second this. I am digging around in the module right now and am having trouble figuring out how to do this...
Comment #2
jdtart CreditAttribution: jdtart commentedAh, ok, it's actually really easy to manually change this. In the weather.module file, lines 367 & 371, change the php function from gmdate() to date(), and then change the format from 'G:i T' to 'g:i T'.
So the lines should look like this:
367: $text = date('g:i T', $metar['daytime']['sunrise_on']);
and
371: $text = date('g:i T', $metar['daytime']['sunset_on']);
All done. Shows up correctly for me now in local (EST) time.
Comment #3
plexato CreditAttribution: plexato commentedGreat, thanks. I'll have a look at this.
Does this "hack" make use of drupals timezone setting? Or is it just using the server's local timezone? (I'm not so familiar with the drupal and the weather module code.)
Comment #4
toddy CreditAttribution: toddy commentedNo, this does not use Drupal's timezone, only the server's local timezone.
Comment #5
toddy CreditAttribution: toddy commentedHi, this is fixed in CVS HEAD.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
plexato CreditAttribution: plexato commentedthanks, works well!