]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Temporal.php
Remove get_server() in favor of Search::getGlobalDirectory()
[friendica.git] / src / Util / Temporal.php
index ec71ab5e963e4604f7c8c072ff1c11295f7bc3b7..6a331104eec74caaf50f62de5c551aedb85c52a4 100644 (file)
@@ -122,13 +122,12 @@ class Temporal
         * @brief Wrapper for date selector, tailored for use in birthday fields.
         *
         * @param string $dob Date of Birth
+        * @param string $timezone
         * @return string Formatted HTML
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+        * @throws \Exception
         */
-       public static function getDateofBirthField($dob)
+       public static function getDateofBirthField(string $dob, string $timezone = 'UTC')
        {
-               $a = \get_app();
-
                list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d');
 
                if ($dob < '0000-01-01') {
@@ -137,7 +136,7 @@ class Temporal
                        $value = DateTimeFormat::utc(($year > 1000) ? $dob : '1000-' . $month . '-' . $day, 'Y-m-d');
                }
 
-               $age = (intval($value) ? self::getAgeByTimezone($value, $a->user["timezone"], $a->user["timezone"]) : "");
+               $age = (intval($value) ? self::getAgeByTimezone($value, $timezone, $timezone) : "");
 
                $tpl = Renderer::getMarkupTemplate("field_input.tpl");
                $o = Renderer::replaceMacros($tpl,