gtbu / Typesetter-5.3-p8

Typesetter 5.2+ with updates and adaptions for php8
http://typesetter5.bplaced.net
GNU General Public License v2.0
11 stars 7 forks source link

Class "IntlDateFormatter" not found -php 8.2 #24

Open gtbu opened 11 months ago

gtbu commented 11 months ago

Under php 8.2 , a click at the revision-history-button gives

Class "IntlDateFormatter" not found - in ....\thirdparty\time\strftime.php on line: 61 (54) -

and add behind the first line

namespace PHP81_BC;

use DateTime; use DateTimeZone; use DateTimeInterface; use Exception; use IntlDateFormatter; use IntlGregorianCalendar; use InvalidArgumentException;

TheWitness commented 7 months ago

You should ensure that php-intl is installed. Run php -m and look for Intl

gtbu commented 7 months ago

Yes - but intl is nowadays a standard - except under Xampp, where You sholud activate intl and zip in the php.ini

TheWitness commented 7 months ago

The INTL library can not handle common sprintf like:

strftime("The rain in Spain falls on the %M'th day of %Y\n");

Why I say they messed up.

gtbu commented 7 months ago

In PHP 8.1 and later versions, you can use the DateTimeImmutable class to achieve similar functionality as the strftime() function.

*The strftime function was used to format local time or date according to locale settings, but it has been replaced by the DateTimeInterface::format method. The DateTimeInterface::format method is more powerful and flexible than strftime, and it allows for more customization and control over the formatting of dates and times.

*An alternative is the IntlDateFormatter::format method instead.