X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FTemporal.php;h=6a331104eec74caaf50f62de5c551aedb85c52a4;hb=48baa0be4b662b7c3d2afebad3b78324677fec14;hp=0e9baf2498fa30630bf112aafc6da1cdc8b6ecbc;hpb=cb3f09ae4f344ff83fca9dc435f3cbad1972737f;p=friendica.git diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index 0e9baf2498..6a331104ee 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -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, @@ -158,10 +157,10 @@ class Temporal /** * @brief Returns a date selector * - * @param string $min Unix timestamp of minimum date - * @param string $max Unix timestap of maximum date - * @param string $default Unix timestamp of default date - * @param string $id ID and name of datetimepicker (defaults to "datetimepicker") + * @param DateTime $min Minimum date + * @param DateTime $max Maximum date + * @param DateTime $default Default date + * @param string $id ID and name of datetimepicker (defaults to "datetimepicker") * * @return string Parsed HTML output. * @throws \Friendica\Network\HTTPException\InternalServerErrorException