Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove int typehint #5763

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion libraries/cms/html/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions libraries/joomla/form/fields/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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($value) && $this->value != JFactory::getDbo()->getNullDate())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use $this->value and it should work :)
Same a few lines later.

{
// Get a date object based on the correct timezone.
$date = JFactory::getDate($this->value, 'UTC');
Expand All @@ -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($value) && $this->value != JFactory::getDbo()->getNullDate())
{
// Get a date object based on the correct timezone.
$date = JFactory::getDate($this->value, 'UTC');
Expand Down