Skip to content

Commit

Permalink
Merge pull request #202 from VentureCraft/develop
Browse files Browse the repository at this point in the history
Update FieldFormatter to handle empty dates
  • Loading branch information
duellsy committed Feb 9, 2016
2 parents 7a3d530 + d723e04 commit dcf9f15
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Venturecraft/Revisionable/FieldFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public static function string($value, $format = null)
*/
public static function datetime($value, $format = 'Y-m-d H:i:s')
{
if (empty($value)) {
return null;
}

$datetime = new \DateTime($value);

return $datetime->format($format);
Expand Down

0 comments on commit dcf9f15

Please sign in to comment.