diff --git a/date_api/date_api.module b/date_api/date_api.module
index 9a08a499..d16ee2f6 100644
--- a/date_api/date_api.module
+++ b/date_api/date_api.module
@@ -741,7 +741,7 @@ class DateObject extends DateTime {
     // input values. So set a flag we can use later to tell that this date
     // object was created using only time values, and that the date values are
     // artifical.
-    if (empty($final_date['year']) && empty($final_date['month']) && empty($final_date['day'])) {
+    if (!isset($final_date['year']) && !isset($final_date['month']) && !isset($final_date['day'])) {
       $this->timeOnly = TRUE;
     }
     elseif (empty($this->errors)) {
diff --git a/tests/date_api.test b/tests/date_api.test
index c128959c..c978d662 100644
--- a/tests/date_api.test
+++ b/tests/date_api.test
@@ -350,6 +350,7 @@ class DateAPITestCase extends DrupalWebTestCase {
     $value = $date->format('Y-m');
     $expected = '2009-10';
     $this->assertEqual($expected, $value, "Test new dateObject($input, $timezone, $format): should be $expected, found $value.");
+    $this->assertTrue($date->timeOnly, "Test new dateObject($input, $timezone, $format): should be time only.");
 
     // Create time-only date.
     $input = '0000-00-00T10:30:00';
@@ -359,6 +360,7 @@ class DateAPITestCase extends DrupalWebTestCase {
     $value = $date->format('H:i:s');
     $expected = '10:30:00';
     $this->assertEqual($expected, $value, "Test new dateObject($input, $timezone, $format): should be $expected, found $value.");
+    $this->assertTrue($date->timeOnly, "Test new dateObject($input, $timezone, $format): should be time only.");
 
     // Create time-only date.
     $input = '10:30:00';
@@ -403,6 +405,12 @@ class DateAPITestCase extends DrupalWebTestCase {
     $date = @new dateObject($input, $timezone, $format);
     $this->assertNotEqual(count($date->errors), 0, '23 abc 2012 should be an invalid date');
 
+    // Test invalid dates (i.e. '0' as date) with and without a timezone gives the same result.
+    $date = new DateObject('0000-00-00');
+    $this->assertEqual($date->format('Y-m-d'), '-0001-11-30');
+    $date = new dateObject('0000-00-00',  'Europe/Berlin', 'Y-m-d');
+    $this->assertEqual($date->format('Y-m-d'), '-0001-11-30');
+
     // Test Granularity.
     $input = '2005-06-01 10:30:45';
     $timezone = NULL;
