public function TimelineDate::__construct in Views TimelineJS integration 7.3
File
- src/TimelineDate.php, line 13
Class
- TimelineDate
- Converts date strings to TimelineJS3-compatible date arrays.
Code
public function __construct($date_string, DateTimeZone $timezone = NULL) {
$this->date_string = $date_string;
if (empty($date_string)) {
throw new Exception('Empty date strings are not allowed.');
}
if (is_numeric($date_string)) {
$date_string .= '-01-01';
}
if (phpversion() < '5.3.6' && $timezone === NULL) {
$timezone = new DateTimeZone(date_default_timezone_get());
}
parent::__construct($date_string, $timezone);
}