]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Temporal.php
Merge remote-tracking branch 'upstream/develop' into scheduled-frontend
[friendica.git] / src / Util / Temporal.php
index ef27b54b2d00547e292a629a7164861b69ad3842..b5619cf49cbce0a273d61b608e6ff1e722fdf48e 100644 (file)
@@ -1,7 +1,22 @@
 <?php
-
 /**
- * @file src/Util/Temporal.php
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
 
 namespace Friendica\Util;
@@ -210,7 +225,7 @@ class Temporal
        public static function getDateTimeField(
                DateTime $minDate,
                DateTime $maxDate,
-               DateTime $defaultDate,
+               DateTime $defaultDate = null,
                $label,
                $id       = 'datetimepicker',
                $pickdate = true,
@@ -351,7 +366,7 @@ class Temporal
         * @return int Age in years
         * @throws \Exception
         */
-       public static function getAgeByTimezone($dob, $owner_tz = '')
+       public static function getAgeByTimezone($dob, $owner_tz = ''): int
        {
                if (!intval($dob)) {
                        return 0;
@@ -366,7 +381,7 @@ class Temporal
 
                $interval = $birthdate->diff($currentDate);
 
-               return $interval->format('%y');
+               return (int) $interval->format('%y');
        }
 
        /**