Skip to content

Commit

Permalink
Fix the format for dates to match the googleChartVisualisation template
Browse files Browse the repository at this point in the history
  • Loading branch information
edhgoose committed Feb 14, 2018
1 parent a78884b commit 8a0435a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion DataTable/DataCell.php
Expand Up @@ -77,7 +77,12 @@ public function getValueForArray() {
return self::getValueForArraySatic($this->v);
}
public static function getValueForArraySatic($value) {
return (is_object($value) && $value instanceof \DateTime)? '[new Date]('.($value->format('U')*1000).')[new Date]': $value;
if (is_object($value) && $value instanceof \DateTime) {
$date = $value->format('U') * 1000;
return "new Date[[[{$date}]]]";
} else {
return $value;
}
}

public function getOptions() {
Expand Down

0 comments on commit 8a0435a

Please sign in to comment.