Skip to content
Snippets Groups Projects
Commit dfa79923 authored by Kevin Hill's avatar Kevin Hill
Browse files

fixing the handling of null cell values for date columns. Should fix #193

parent d5001167
No related branches found
No related tags found
No related merge requests found
- 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
Loading
Loading
Loading
Loading
@@ -101,12 +101,15 @@ class Row implements \ArrayAccess, \JsonSerializable
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)) {
Loading
Loading
Loading
Loading
@@ -35,7 +35,7 @@ class JavascriptDate extends Carbon
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;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment