I noticed one more issue with the code in the first post when the time option is enabled for the min/max checks:
if( $this->options['time'] )
{
$string .=' ' . $this->options['min']->setTimeZone( $timezone )->localeTime( \IPS\Member::loggedIn() );
}
=======================
if( $this->options['time'] )
{
$string .=' ' . $this->options['max']->setTimeZone( $timezone )->localeTime( \IPS\Member::loggedIn() );
}
The code passes the logged-in member's object as the first parameter to determine the language, but the function accepts that value as the third parameter instead:
/**
* Format the time according to the user's locale (without the date)
*
* @param bool $seconds If TRUE, will include seconds
* @param bool $minutes If TRUE, will include minutes
* @param \IPS\Lang|\IPS\Member|NULL $memberOrLanguage The language or member to use, or NULL for currently logged in member
* @return string
*/
public function localeTime( $seconds=TRUE, $minutes=TRUE, $memberOrLanguage=NULL )
Both localTime() calls should be updated to:
->localeTime( TRUE, TRUE, \IPS\Member::loggedIn() );
It would be nice if there were also a new option to decide if we want to show the seconds/minutes in the error, but that's a request rather than a bug. 😋