Timezone issues with schedule/calendar list
-
I have been using sportspress for over a year, but have always had issues with the timezone when a calendar is displayed. It always seemed to ignore timezones (so it would should tomorrow even though it was still today, because my timezone was -6 from gmt).
I submitted a request to the Pro support (i’m a registered/paying user) but did not get a satisfactory response. (basically didn’t think it was an issue).Context:
I have timezone set correctly in WordPress (and Sportspress, since it uses the same value). However:
– mysql has a different timezone (off by 1 hour), and I can’t change it because it’s on a shared hosting account.
– php has a different timezone (UTC), and I can’t change that because it’s a shared hosting account.What I found that makes it work correctly is by changing class-sp-schedule.php to call date_i18n() instead of date() when getting the date values for the schedule list:
if ( $this->date !== 0 ): if ( $this->date == 'w' ): $args['year'] = date_i18n('Y'); $args['w'] = date_i18n('W'); elseif ( $this->date == 'day' ): $args['year'] = date_i18n('Y'); $args['day'] = date_i18n('j'); $args['monthnum'] = date_i18n('n'); elseif ( $this->date == 'range' ): add_filter( 'posts_where', array( $this, 'range' ) ); endif; endif;
Not sure if I know the overall ramifications of this, but it makes the list of events work correctly. If there is some other setting or fix that I am missing, please let me know.
Thanks!
- The topic ‘Timezone issues with schedule/calendar list’ is closed to new replies.