This PR fixed the issue #7846. It just add a check to make sure the value passed to JHtml::calendar method is valid.
In case the value is invalid, instead of throwing exception at the moment, it will reset the value to be empty and prevent the error above from happening.
Testing instructions
JHml::calendar is used in many places in Joomla core. To test this, you can try to edit an article, look at Publishing tab, make sure the calendar inputs such as Start Publishing, Created Date... stil display the correct value.
Can you revert the changes with line indent?