X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FTemporal.php;h=e6d0f207df71963d48ae28f140232e3ddcb9642b;hb=17d49422b4f7b3d1ed06859f996876a85028d87b;hp=c4a04d586cb266cd32d647617fe99056bdd420f6;hpb=d09b3f5bdeae444f785f6283e55dbf2f61caadac;p=friendica.git
diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php
index c4a04d586c..e6d0f207df 100644
--- a/src/Util/Temporal.php
+++ b/src/Util/Temporal.php
@@ -1,6 +1,6 @@
t(
+ 'Time zone: %s Change in Settings',
+ str_replace('_', ' ', DI::app()->getTimeZone()) . ' (GMT ' . DateTimeFormat::localNow('P') . ')',
+ DI::baseUrl() . '/settings'
+ ),
$required ? '*' : '',
'placeholder="' . $readable_format . '"'
],
@@ -284,7 +288,7 @@ class Temporal
'lang' => $lang,
'minfrom' => $minfrom,
'maxfrom' => $maxfrom,
- ]
+ ],
]);
return $o;
@@ -360,28 +364,24 @@ class Temporal
* Returns the age in years, given a date of birth and the timezone of the person
* whose date of birth is provided.
*
- * @param string $dob Date of Birth
- * @param string $owner_tz (optional) Timezone of the person of interest
+ * @param string $dob Date of Birth
+ * @param string $timezone Timezone of the person of interest
*
* @return int Age in years
* @throws \Exception
*/
- public static function getAgeByTimezone($dob, $owner_tz = '')
+ public static function getAgeByTimezone(string $dob, string $timezone): int
{
if (!intval($dob)) {
return 0;
}
- if (!$owner_tz) {
- $owner_tz = date_default_timezone_get();
- }
-
- $birthdate = new DateTime($dob . ' 00:00:00', new DateTimeZone($owner_tz));
+ $birthdate = new DateTime($dob . ' 00:00:00', new DateTimeZone($timezone));
$currentDate = new DateTime('now', new DateTimeZone('UTC'));
$interval = $birthdate->diff($currentDate);
- return $interval->format('%y');
+ return (int) $interval->format('%y');
}
/**