get_post_time() of mc-events gives incorrect value
-
Hi,
I’m working on creating a RSS feed that incorporates My Calendar events in with regular WordPress posts. My results were sorting incorrectly, and I finally figured out why. I think it is a bug in My Calendar, so I thought I’d let you know.
Using the get_post_time() function, depending on whether or not the $gmt argument is set, mc-events return two wildly different values.
Relevant codex page: https://codex.wordpress.org/Template_Tags/get_post_time
Expected Behavior:
The results of calling get_post_time($format, $gmt) should differ by $gmt_offset (whatever is set in WordPress). In our case, this is -7 hours. get_post_time($format, true) should return a datetime 7 hours ahead of get_post_time($format, false).Actual Behavior:
The results of calling get_post_time() differ by more than five days.Example:
Code (I know, not valid XML tags but just for testing/debugging purposes):
<postTimeTrue>'.get_post_time('D, d M Y H:i:s +0000', true).'</postTimeTrue> <postTimeFals>'.get_post_time('D, d M Y H:i:s +0000', false).'</postTimeFals>
Result:
<postTimeTrue>Tue, 20 Feb 2018 10:20:18 +0000</postTimeTrue> <postTimeFals>Sun, 25 Feb 2018 11:22:28 +0000</postTimeFals>
Thanks!
- The topic ‘get_post_time() of mc-events gives incorrect value’ is closed to new replies.