Skip to content

Commit

Permalink
Merge pull request #164 from marc1706/birthday/year_opt
Browse files Browse the repository at this point in the history
[birthday/year_opt] Make year optional for displaying date in birthday ahead
  • Loading branch information
marc1706 committed Oct 29, 2013
2 parents 32a63f3 + 36fdb4d commit 259d6d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions root/portal/modules/portal_birthday_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ public function uninstall($module_id)
*/
protected function format_birthday($user, $birthday, $date_settings)
{
if (!preg_match('/(?:[0-9])+-+(?:[0-9]{2})+-+(?:[0-9]{4})/', $birthday, $match))
if (!preg_match('/(?:[0-9])+-+(?:[0-9]{2})+-+(?:[0-9]{4})?/', $birthday, $match))
{
return '';
}

$date = explode('-', $birthday);
$time = mktime(0, 0, 0, $date[1], $date[0], $date[2]);
$time = mktime(0, 0, 0, $date[1], $date[0], (isset($date[2])) ? $date[2] : 0);
$lang_dates = array_filter($user->lang['datetime'], 'is_string');

return strtr(date($date_settings, $time), $lang_dates);
Expand Down

0 comments on commit 259d6d8

Please sign in to comment.