From 935479234170df5c4acf69721592ca60269cd298 Mon Sep 17 00:00:00 2001
From: Franz Glauber Vanderlinde <franz.glauber@gmail.com>
Date: Wed, 20 Mar 2013 14:47:45 -0300
Subject: [PATCH] Issue #857216 by yareckon, wuinfo: behavior on importing
 empty/NULL/invalid dates.

---
 mappers/date.inc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mappers/date.inc b/mappers/date.inc
index 3de6a69f..a96143a3 100644
--- a/mappers/date.inc
+++ b/mappers/date.inc
@@ -51,7 +51,10 @@ function date_feeds_set_target($source, $entity, $target, $feed_element) {
     if (is_array($feed_element)) {
       $feed_element = $feed_element[0];
     }
-    if ($sub_field == 'end') {
+    if (empty($feed_element) || !is_numeric($feed_element) && !date_create($feed_element)) {
+      $feed_element = new FeedsDateTimeElement(NULL, NULL);
+    }
+    elseif ($sub_field == 'end') {
       $feed_element = new FeedsDateTimeElement(NULL, $feed_element);
     }
     else {
-- 
GitLab