Local time instead of GMT
-
I’ve tried to use post.post_date and customfield containing the date value in a mail template and I realized that they are always displayed in GMT. Because the local time value is more useful in emails, I’ve added the ‘useLocalTime’ modifier and handling code in src\Types\Parameters\BaseParameter.php:
public function formatDate($value, $modifiers) { $waOptions = get_option('wunderauto-general'); $format = null; if (isset($modifiers->format)) { $format = $modifiers->format; } if (empty($format) && isset($waOptions['datetimeformat']) && strlen($waOptions['datetimeformat']) > 0) { $format = $waOptions['datetimeformat']; } if (empty($format)) { $format = get_option('date_format'); } /* MF+ handle useLocalTime modifier */ $timestamp = $this->toEpoch($value); if (isset($modifiers->useLocalTime)) { $timestamp = $timestamp + floatval( get_option( 'gmt_offset', 0 ) ) * HOUR_IN_SECONDS; } return date($format, $timestamp); /* +MF */ }
Take a look on it, if you find it useful, feel free to include it in future releases.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Local time instead of GMT’ is closed to new replies.