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

jdtart’s picture

I second this. I am digging around in the module right now and am having trouble figuring out how to do this...

jdtart’s picture

Ah, 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.

plexato’s picture

Great, 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.)

toddy’s picture

Assigned: Unassigned » toddy

No, this does not use Drupal's timezone, only the server's local timezone.

toddy’s picture

Status: Active » Fixed

Hi, this is fixed in CVS HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

plexato’s picture

thanks, works well!