mirror of
https://github.com/friendica/friendica
synced 2025-05-01 23:04:24 +02:00
Remove dependency to App object in Temporal::getDateofBirthField
This commit is contained in:
parent
f19136905f
commit
118e737a49
2 changed files with 5 additions and 6 deletions
|
@ -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($dob, $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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue