diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a8bdf42..5e718b2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +- 3.1.3 + - Adding JavascriptDate class that mimics the way the Javascript Date object is created. (I wanted to be able to copy and paste google's examples into addRows) + - 3.1.1 & 3.1.2 - Adding back and repairing the Symfony Bundle diff --git a/src/DataTables/Rows/Row.php b/src/DataTables/Rows/Row.php index ec7384fa..efa178ba 100644 --- a/src/DataTables/Rows/Row.php +++ b/src/DataTables/Rows/Row.php @@ -101,12 +101,15 @@ public static function create(DataTable $datatable, $valueArray) foreach ($valueArray as $index => $cellValue) { if ((bool) preg_match('/date|datetime|timeofday/', $columnTypes[$index]) === true) { if (StringValue::isNonEmpty($cellValue) === false && - $cellValue instanceof Carbon === false + $cellValue instanceof Carbon === false && + $cellValue !== null ) { throw new InvalidDate($cellValue); } - if ($cellValue instanceof Carbon) { + if ($cellValue === null) { + $rowData[] = new NullCell; + } else if ($cellValue instanceof Carbon) { $rowData[] = new DateCell($cellValue); } else { if (isset($dateTimeFormat)) { diff --git a/src/Support/JavascriptDate.php b/src/Support/JavascriptDate.php index 6885e316..2f7cce49 100644 --- a/src/Support/JavascriptDate.php +++ b/src/Support/JavascriptDate.php @@ -35,7 +35,7 @@ public function __construct() if (isset($args[3]) === false) { $hour = $defaults['hour']; $minute = isset($args[4]) ? $args[4] : $defaults['minute']; - $second = isset($args[5]) ? $args[5] : $defaults['minute']; + $second = isset($args[5]) ? $args[5] : $defaults['second']; } else { $minute = isset($args[4]) ? $args[4] : 0; $second = isset($args[5]) ? $args[5] : 0;