hekmatinasser / verta
This Package helps developers to work with Jalali Datetime class for Laravel Framework PHP
Fund package maintenance!
hekmatinasser
Installs: 321 661
Dependents: 35
Suggesters: 0
Security: 0
Stars: 598
Watchers: 12
Forks: 77
Open Issues: 0
Requires
- php: ^8.0
- hekmatinasser/jalali: ^8.2.3
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- illuminate/validation: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^6.23|^7.0|^8.0
- dev-master
- 8.x-dev
- v8.4.1
- v8.4
- v8.3.2
- v8.3.1
- v8.3
- v8.2
- v8.1.9
- v8.1.8
- v8.1.7
- v8.1.6
- v8.1.5
- v8.1.4
- v8.1.3
- v8.1.2
- v8.1.1
- v8.1
- v8.0
- v2.1.1
- 2.1
- v2.0.2
- v2.0.1
- v2
- v1.12.7
- v1.12.6
- v1.12.5
- v1.12.4
- v1.12.3
- v1.12.2
- v1.12.1
- v1.12
- v1.11.10
- v1.11.9
- v1.11.8
- v1.11.7
- v1.11.6
- v1.11.5
- v1.11.4
- v1.11.3
- v1.11.2
- v1.11.1
- v1.11
- v1.10.7
- v1.10.6
- v1.10.5
- v1.10.4
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.14
- v1.9.13
- v1.9.12
- v1.9.11
- v1.9.10
- v1.9.9
- v1.9.8
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9
- v1.8.9
- v1.8.8
- v1.8.7
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8
- v1.7.2
- v1.7.1
- v1.7
- v1.6
- v1.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4
- v1.3
- v1.2
- v1.1.2
- v1.1.1
- v1.1
- v1.0.1
- v1.0
This package is auto-updated.
Last update: 2024-11-09 16:27:16 UTC
README
hekmatinasser/verta
The Verta is package for change solar calendar and gregorian together and provide helper function to use date and time.
Verta extend class PHP Datetime and Jalali, compatible with Carbon Package.
This package has been created by Nasser Hekmati under the license of MIT.
Quick view
- Installation
- Usage
- Getters
- Setters
- Formatting
- Modification
- Boundaries
- Compression
- Validation
- Localization
- Validation Request
- Licence
- Contributors
Installation
composer require hekmatinasser/verta
Usage
use verta datetime jalali
echo verta(); //1401-05-24 00:00:00
Gregorian to Jalali
change gregorian to jalali and reverse
echo verta('2022-08-15'); //1401-05-24 00:00:00
jalali to Gregorian
change jalali to gregorian and reverse
echo Verta::parse('1401-05-24 14:12:32')->datetime(); //2022-08-15 00:00:00
Carbon to Jalali
change carbon to jalali and reverse
echo now()->toJalali(); //1401-05-24 00:00:00
Jalali to Carbon
change jalali to gregorian and reverse
echo verta()->toCarbon(); //2022-08-15 00:00:00
Getters
access part of jalali datetime
$v = verta(); // 1396-03-14 14:18:23 echo $v->year; // 1396
Setters
set part of jalali datetime
$v = verta(); // 1396-03-14 14:18:23 echo $v->year = 1395;
Fluent Setters
set multiple part of jalali datetime
$v = verta(); // 1396-03-14 14:18:23 echo $v->setTimeString('12:25:45');
Formatting
show datetime variant datetime
echo verta()->format('Y.m.d'); // 1401.05.24 echo verta()->formatWord('l dS F'); // دوشنبه بیست و چهارم مرداد
Common Formats
show common datetime variant datetime
echo verta()->formatJalaliDatetime(); // output 1395/10/07 14:12:25
Difference for Humans
show difference format readable humans
echo verta('-13 month')->formatDifference(); // 1 سال قبل
Modification
manipulate jalali datetime
echo verta()->addWeeks(3); ...
Boundaries
get boundary jalali datetime
echo verta()->startWeek(3);
Compression
get compression jalali datetime
echo verta('+2 day')->gte('2022-08-15');
Difference
calculate difference two jalali datetime
echo verta('+13 day')->diffMonths('2022-08-15');
Validation
check datetime check is valid
echo Verta::isLeapYear(1394); // false
Localization
set language for formatting datetime
Verta::setLocale('ar');
Validation Request
validation input form
'birthday' => ['required', 'jdate_before_equal']
Licence
This package has been created by Nasser Hekmati under the license of MIT.
Contributors
Thanks to people who contributed for grow verta.