Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

+41 -1
View File
@@ -32,7 +32,7 @@ class _DateTime extends \DateTime
public static function ts( $timestamp, $bypassTimezone=FALSE )
{
$obj = new static;
$obj->setTimestamp( $timestamp );
$obj->setTimestamp( (int) $timestamp );
if ( !$bypassTimezone AND \IPS\Dispatcher::hasInstance() and \IPS\Member::loggedIn()->timezone )
{
$validTimezone = TRUE;
@@ -86,6 +86,21 @@ class _DateTime extends \DateTime
return static::$timeZoneIdentifiers;
}
/**
* Helper method to fix Argentinian Timezones https://bugs.webkit.org/show_bug.cgi?id=218542
*
* @param string $timezone
* @return string|null
*/
public static function getFixedTimezone( ?string $timezone=NULL ) :? string
{
if ( \in_array( $timezone, [ 'America/Buenos_Aires', 'America/Catamarca', 'America/Cordoba', 'America/Jujuy', 'America/La_Rioja', 'America/Mendoza', 'America/Rio_Gallegos', 'America/Salta', 'America/San_Juan', 'America/San_Luis', 'America/Tucuman', 'America/Ushuaia' ] ) )
{
return 'America/Argentina/' . \substr( $timezone, 8 );
}
return $timezone;
}
/**
* Create New
@@ -199,6 +214,31 @@ class _DateTime extends \DateTime
return "<time datetime='{$this->rfc3339()}' title='{$this}' data-short='" . trim( $this->relative( 1, $memberOrLanguage ) ) . "'>" . trim( $this->relative( $format, $memberOrLanguage ) ) . "</time>";
}
/**
* Get total number of days from DateInterval
*
* @param \DateInterval $interval DateInterval
* @return int
*/
static public function intervalToDays( \DateInterval $interval ): int
{
$days = 0;
if ( $interval->y )
{
$days += ( 365 * $interval->y );
}
if ( $interval->m )
{
$days += ( ( 365 / 12 ) * $interval->m );
}
if ( $interval->d )
{
$days += $interval->d;
}
return $days;
}
/**
* Format the date according to the user's locale (without the time)
*