diff --git a/libraries/cms/html/html.php b/libraries/cms/html/html.php
index 5c1c4a95aafbd..9c75eddb2e9fa 100644
--- a/libraries/cms/html/html.php
+++ b/libraries/cms/html/html.php
@@ -975,7 +975,7 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri
static::_('bootstrap.tooltip');
// Format value when not nulldate ('0000-00-00 00:00:00'), otherwise blank it as it would result in 1970-01-01.
- if ((int) $value && $value != JFactory::getDbo()->getNullDate())
+ if (!is_null($value) && $value != JFactory::getDbo()->getNullDate())
{
$tz = date_default_timezone_get();
date_default_timezone_set('UTC');
diff --git a/libraries/joomla/form/fields/calendar.php b/libraries/joomla/form/fields/calendar.php
index cb751859428a1..d81413f947fc8 100644
--- a/libraries/joomla/form/fields/calendar.php
+++ b/libraries/joomla/form/fields/calendar.php
@@ -177,7 +177,7 @@ protected function getInput()
{
case 'SERVER_UTC':
// Convert a date to UTC based on the server timezone.
- if ((int) $this->value && $this->value != JFactory::getDbo()->getNullDate())
+ if (!is_null($this->value) && $this->value != JFactory::getDbo()->getNullDate())
{
// Get a date object based on the correct timezone.
$date = JFactory::getDate($this->value, 'UTC');
@@ -191,7 +191,7 @@ protected function getInput()
case 'USER_UTC':
// Convert a date to UTC based on the user timezone.
- if ((int) $this->value && $this->value != JFactory::getDbo()->getNullDate())
+ if (!is_null($this->value) && $this->value != JFactory::getDbo()->getNullDate())
{
// Get a date object based on the correct timezone.
$date = JFactory::getDate($this->value, 'UTC');