You are here

function views_timelinejs_date_source_post_date_conversion in Views TimelineJS integration 7

Converts post date formats, forces TimelineJS to ignore browser TZ.

Converts different expected date formats to one global date format to be used in TimelineJS. Uses Drupal's TZ, not field TZ. Adds Z to ISODate to force TimelineJS to ignore browser timezone.

Return value

string Formatted date.

1 string reference to 'views_timelinejs_date_source_post_date_conversion'
post_date.inc in plugins/date_sources/post_date.inc

File

plugins/date_sources/post_date.inc, line 24

Code

function views_timelinejs_date_source_post_date_conversion($date, $output_format, $options = array()) {
  $granularity = array();
  $input_format = 'timestamp';
  $timezone = views_timelinejs_get_timezone();
  $db_timezone = 'UTC';
  switch ($output_format) {
    case 'csv':
      return views_timelinejs_convert_to_csv($date, $input_format, $timezone, $db_timezone, $granularity);
    case 'timestamp':
      return views_timelinejs_convert_to_timestamp($date, $input_format, $timezone, $db_timezone);
  }
}