diff --git a/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php
index 505306f05002056727364af7f4801e5a0bb75f68..4c5c6eda37df9d97157bcea16e458f16e409a861 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php
@@ -127,6 +127,13 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
     }
     $settings = isset($this->configuration['settings']) ? $this->configuration['settings'] : [];
 
+    // Older versions of Drupal where omitting certain granularities (also known
+    // as "collected date attributes") resulted in invalid timestamps getting
+    // stored.
+    if ($fromFormat === 'Y-m-d\TH:i:s') {
+      $value = str_replace(['-00-00T', '-00T'], ['-01-01T', '-01T'], $value);
+    }
+
     // Attempts to transform the supplied date using the defined input format.
     // DateTimePlus::createFromFormat can throw exceptions, so we need to
     // explicitly check for problems.
diff --git a/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php b/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php
index 629243c84cff1108268d1ced769fd2b4f2edb413..f3485f171452dccc01e6e4d3e0cd9ea5230e7ead 100644
--- a/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php
@@ -229,6 +229,22 @@ public function datesDataProvider() {
         'value' => '0000-00-00 00:00:00',
         'expected' => '-0001-11-30 00:00:00',
       ],
+      'collected_date_attributes_day' => [
+        'configuration' => [
+          'from_format' => 'Y-m-d\TH:i:s',
+          'to_format' => 'Y-m-d\TH:i:s',
+        ],
+        'value' => '2012-01-00T00:00:00',
+        'expected' => '2012-01-01T00:00:00',
+      ],
+      'collected_date_attributes_month' => [
+        'configuration' => [
+          'from_format' => 'Y-m-d\TH:i:s',
+          'to_format' => 'Y-m-d\TH:i:s',
+        ],
+        'value' => '2012-00-00T00:00:00',
+        'expected' => '2012-01-01T00:00:00',
+      ],
     ];
   }