morilog / jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in php appliations, based on Jalali (Shamsi) DateTime class.
MIT License
860 stars 110 forks source link

Not supporting diffForHumans #148

Closed mohammadyahia123 closed 2 years ago

mohammadyahia123 commented 2 years ago

At start I wanted to keep working with some notes that needed to be displayed as human readable time difference, but I coyldn't find the persian format of the diffForHuman method of carbon.

mhyeganeh commented 2 years ago

You can simply use diffForHumans() method of Cabon package by setting disired locale in config/app.php file or dynamically:

Carbon::setLocale('fa');
echo $record->created_at->diffForHumans();  //۳ روز پیش
morilog commented 2 years ago

You can use ago method to display human readable and relative datetime