Skip to content

Bug: Time::humanize() does not work with ar locale #4708

Closed
@perspolise

Description

@perspolise

I set arabic language in app config file for defualtLocale like this:

public $defaultLocale = 'ar';

Now, I work with humanize time function like this:

$time = CodeIgniter\I18n\Time::parse($date, 'America/Chicago');
return $time->humanize(); 

Now in action I get this error:


DateTime::__construct(): Failed to parse time string (٢٠٢١-٠٥-١٩ ٠١:٤٧:٢٨) at position 0 (�): Unexpected character

SYSTEMPATH\I18n\Time.php at line 1150

public function humanize()
1149     {
1150         $now  = IntlCalendar::fromDateTime(Time::now($this->timezone)->toDateTimeString());

I think the DateTime function have problem with arabic number. because when I set en for default locale, humanize function work truly.

@lonnieezell @MGatner

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions