Skip to content

Commit

Permalink
FIX: Code Syntax - PHP - AgeHelper.php
Browse files Browse the repository at this point in the history
  • Loading branch information
aljawaid committed May 12, 2023
1 parent 5c2e734 commit 0a6ec68
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions Helper/AgeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,28 @@ public function newAge($timestamp, $now = null)
// 86400s /day

switch ($diff) {
case $diff < 60 : return '<span class="age-pass">'. t('less than a minute ago') .'</span>';
case $diff < 3600 : return '<span class="age-pass">'. t('around %d minutes ago', $diff / 60) .'</span>'; // <1h
case $diff < 86400 : return '<span class="age-pass">'. t('around %d hours ago', $diff / 3600) .'</span>'; // <24h
case $diff < 604800 : return '<span class="age-pass">'. t('around %d days ago', $diff / 86400) .'</span>'; // <7D
case $diff < 2592000 : return '<span class="age-pass">'. t('around %d weeks ago', $diff / 604800) .'</span>'; // <30D
case $diff < 31104000 : return '<span class="age-pass">'. t('around %d months ago', $diff / 2592000) .'</span>'; // <360D
case $diff < 62208000 : return '<span class="age-warning">'. t('over a year ago') .'</span>'; // <360D*2
case $diff < 60:
return '<span class="age-pass">' . t('less than a minute ago') .'</span>';
case $diff < 3600:
// <1h
return '<span class="age-pass">' . t('around %d minutes ago', $diff / 60) . '</span>';
case $diff < 86400:
// <24h
return '<span class="age-pass">' . t('around %d hours ago', $diff / 3600) . '</span>';
case $diff < 604800:
// <7D
return '<span class="age-pass">' . t('around %d days ago', $diff / 86400) . '</span>';
case $diff < 2592000:
// <30D
return '<span class="age-pass">' . t('around %d weeks ago', $diff / 604800) . '</span>';
case $diff < 31104000:
// <360D
return '<span class="age-pass">' . t('around %d months ago', $diff / 2592000) . '</span>';
case $diff < 62208000:
// <360D*2
return '<span class="age-warning">' . t('over a year ago') . '</span>';
default:
return '<span class="age-danger">'. t('over %d years ago' , $diff / 31104000) .'</span>';
return '<span class="age-danger">' . t('over %d years ago' , $diff / 31104000) . '</span>';
}
}
}

0 comments on commit 0a6ec68

Please sign in to comment.