diff --git a/src/Spout/Common/Entity/Cell.php b/src/Spout/Common/Entity/Cell.php index f1f7c1d..73e7040 100644 --- a/src/Spout/Common/Entity/Cell.php +++ b/src/Spout/Common/Entity/Cell.php @@ -182,6 +182,14 @@ class Cell return $this->type === self::TYPE_STRING; } + /** + * @return bool + */ + public function isDate() + { + return $this->type === self::TYPE_DATE; + } + /** * @return bool */ diff --git a/tests/Spout/Common/Entity/CellTest.php b/tests/Spout/Common/Entity/CellTest.php index 7b97850..e5f763a 100644 --- a/tests/Spout/Common/Entity/CellTest.php +++ b/tests/Spout/Common/Entity/CellTest.php @@ -54,6 +54,15 @@ class CellTest extends \PHPUnit\Framework\TestCase $this->assertTrue((new Cell(false))->isBoolean()); } + /** + * @return void + */ + public function testCellTypeDate() + { + $this->assertTrue((new Cell(new \DateTime()))->isDate()); + $this->assertTrue((new Cell(new \DateInterval('P2Y4DT6H8M')))->isDate()); + } + /** * @return void */