Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Nov 8, 2024
1 parent ac8ea0a commit c433327
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions web/functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1765,15 +1765,8 @@ function times_somewhere(bool $only_enabled=false) : bool
// to make sure it's a valid date
function format_iso_date(int $year, int $month, int $day) : string
{
if (!checkdate($month, $day, $year))
{
$date = getdate(mktime(12, 0, 0, $month, $day, $year));
$year = $date['year'];
$month = $date['mon'];
$day = $date['mday'];
}

return sprintf("%04d-%02d-%02d", $year, $month, $day);
$date = new DateTime();
return $date->setDate($year, $month, $day)->format('Y-m-d');
}


Expand Down

0 comments on commit c433327

Please sign in to comment.