function SimpleNewsSchedulerWebTestCase::format_date_helper in Simplenews Scheduler 6.2
Workaround helper for format_date() to fix timezone issues.
This takes care of calculating the right offset to pass to the $timezone parameter.
Parameters
$date: A PHP DateTime object.
...: Other params same as format_date(). $timezone is ignored.
Return value
As format_date().
See also
http://drupal.org/node/1528598.
2 calls to SimpleNewsSchedulerWebTestCase::format_date_helper()
- SimpleNewsSchedulerDaylightSavingSwitchTest::testDSTMonthly in tests/
simplenews_scheduler.test - Test edition time after DST changes for a monthly newsletter.
- SimpleNewsSchedulerNodeCreationTest::testNewsletterGeneration in tests/
simplenews_scheduler.test - Basic simplenews newsletter generation test create a simplenews node,
File
- tests/
simplenews_scheduler.test, line 57 - Tests for Simplenews Scheduler.
Class
- SimpleNewsSchedulerWebTestCase
- Class with common setup.
Code
function format_date_helper($date, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) {
// Build the right offset to give to format_date(), because it's stupid.
$format_date_offset = $this->site_timezone_object
->getOffset($date);
return format_date($date
->getTimestamp(), $type, $format, $format_date_offset);
}