Skip to content

Commit

Permalink
fixed empty datetime values
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Aug 27, 2016
1 parent 341f62a commit b2e08c0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Fields/Datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class Datetime extends Field
*/
public function dataToDatabase($data)
{
if (empty($data)) {
return null;
}

if (is_string($data)) {
return date($this->format, strtotime($data));
}
Expand Down

0 comments on commit b2e08c0

Please sign in to comment.