Skip to content

Commit

Permalink
catch error if php intl extension is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianswebworld authored Jan 27, 2024
1 parent 266536a commit 1894ded
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions includes/ttxweb_decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,14 @@ function renderRow0() {

$myDate = new DateTime();

$formatter = new IntlDateFormatter($ttxLanguage, IntlDateFormatter::FULL, IntlDateFormatter::FULL);
$formatter->setPattern('EEEEEE');
$myWeekDay = substr($formatter->format($myDate), 0, 2);
if (class_exists('IntlDateFormatter')) {
$formatter = new IntlDateFormatter($ttxLanguage, IntlDateFormatter::FULL, IntlDateFormatter::FULL);
$formatter->setPattern('EEEEEE');
$myWeekDay = substr($formatter->format($myDate), 0, 2);
}
else {
$myWeekDay = substr($myDate->format('D'), 0, 2);
}

$myMonth = str_pad($myDate->format('m'), 2, '0', STR_PAD_LEFT);
$myDay = str_pad($myDate->format('d'), 2, '0', STR_PAD_LEFT);
Expand Down

0 comments on commit 1894ded

Please sign in to comment.