From fbefdef536b5aa51a9b375cc275d389b85d2c40e Mon Sep 17 00:00:00 2001
From: nasser
+
-مستندات فارسی
-English Document
+English Document
ورتا پکیجی برای تبدیلات تاریخ شمسی و میلادی به یکدیگر و شامل توابع کمکی که کاربران به راحتی بتوانند تبدیلات تاریخ خود را انجام دهند زبان پی اچ پی دارای کلاسی برای تاریخ و زمان است که ورتا از همین کلاس ارث بری کرده است ورتا از الگوریتم تبدیل تاریخ شمسی به میلادی و بالعکس استفاده می کند. الگوریتم مبدل تاریخ بر اساس الگوریتم تاریخ جلالی وحید سهراب لو، روزبه پورنادر و محمد توسی می باشد
- این پکیج توسط ناصر حکمتی تحت مجوز ام ای تی منتشر شده است.
- 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.
+hekmatinasser/verta
-
-c7nR0nwZaFTFdLPpvlf%mygDCWC#!_3G%g>hNU(1KC0}EfIeEt5`@o={3{1J4swBnW!r(?N$%;AH6F~G~Ks0HvO}lr&+g2
zA6!2ve>ey`4Mw@o)eDZc*Z7@Q>Oa^_M;LMD^uX(i_@w5O
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.
+ + +| Laravel Version | +Package Version | +
|---|---|
| 8.0 | +8.x | +
| 9.0 | +8.x | +
change jalali to gregorian and reverse
+ +```php +echo verta('2022-08-15'); //1401-05-24 00:00:00 +echo Verta::parse('1395-10-07 14:12:32') +``` + +access part of jalali datetime
+ +```php +$v = verta(); // 1396-03-14 14:18:23 +echo $v->year; // 1396 +... +``` + +show datetime variant datetime
+ +```php +echo verta('-13 month')->formatDifference(); // 1 سال قبل +echo verta()->formatWord('l dS F'); // دوشنبه بیست و چهارم مرداد +... +``` + +manipulate jalali datetime
+ +```php +echo verta()->addWeeks(3); +... +``` + +get boundary jalali datetime
+ +```php +echo verta()->startWeek(3); +... +``` + +calculate diff two jalali datetime
+ +```php +echo verta('+13 day')->diffMonths('2022-08-15'); +... +``` + +get boundary jalali datetime
+ +```php +echo verta('+2 day')->gte('2022-08-15'); +... +``` + + +validation input form
+ +```php +'birthday' => ['required', 'jdate_before_equal'] +... +``` +This package has been created by Nasser Hekmati under the license of MIT.
+ From 31da55d8d3f73ac8d16cba08bc211ed356a40845 Mon Sep 17 00:00:00 2001 From: nasserVerta extend class PHP Datetime and Jalali, compatible with Carbon Package.
-change jalali to gregorian and reverse
+## Usage +use verta datetime jalali
+ +```php +echo verta(); //1401-05-24 00:00:00 +``` + +### Gregorian to Jalali +change gregorian to jalali and reverse
```php echo verta('2022-08-15'); //1401-05-24 00:00:00 -echo Verta::parse('1395-10-07 14:12:32') +``` + +### jalali to Gregorian +change jalali to gregorian and reverse
+ +```php +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
+ +```php +echo now()->toJalali(); //1401-05-24 00:00:00 +``` + +### Jalali to Carbon +change jalali to gregorian and reverse
+ +```php +echo verta()->toCarbon(); //2022-08-15 00:00:00 ```calculate diff two jalali datetime
```php @@ -107,6 +158,11 @@ echo verta('+2 day')->gte('2022-08-15'); 'birthday' => ['required', 'jdate_before_equal'] ... ``` +## Licence -This package has been created by Nasser Hekmati under the license of MIT.
+This package has been created by Nasser Hekmati under the license of MIT. +## Contributors +Thanks to people who contributed for grow varta. + +-Document -
+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.
@@ -29,18 +27,18 @@ - [Fluent Setters](#fluent-setters) - [Formatting](#formatting) - [Common Formats](#common-formats) + - [Difference for Humans](#difference-for-humans) - [Modification](#modification) - [Boundaries](#boundaries) - [Compression](#compression) - [Difference](#difference) - - [Difference for Humans](#difference-for-humans) - [Validation](#validation) - [Localization](#localization) - [Validation Request](#validation-request) - [Licence](#licence) - [Contributors](#contributors) -## Installations +### Installation ```shell composer require hekmatinasser/verta @@ -65,104 +63,164 @@ composer require hekmatinasser/verta -## Usage +### Usageuse verta datetime jalali
```php echo verta(); //1401-05-24 00:00:00 ``` -### Gregorian to Jalali +#### Gregorian to Jalalichange gregorian to jalali and reverse
```php echo verta('2022-08-15'); //1401-05-24 00:00:00 ``` -### jalali to Gregorian +#### jalali to Gregorianchange jalali to gregorian and reverse
```php echo Verta::parse('1401-05-24 14:12:32')->datetime(); //2022-08-15 00:00:00 ``` -### Carbon to Jalali +#### Carbon to Jalalichange carbon to jalali and reverse
```php echo now()->toJalali(); //1401-05-24 00:00:00 ``` -### Jalali to Carbon +#### Jalali to Carbonchange jalali to gregorian and reverse
```php echo verta()->toCarbon(); //2022-08-15 00:00:00 ``` +[view more function](https://hekmatinasser.github.io/verta/#instantiate) -access part of jalali datetime
```php $v = verta(); // 1396-03-14 14:18:23 echo $v->year; // 1396 -... ``` +[view more getter](https://hekmatinasser.github.io/verta/#getter) -set part of jalali datetime
+ +```php +$v = verta(); // 1396-03-14 14:18:23 +echo $v->year = 1395; +``` +[view more setter](https://hekmatinasser.github.io/verta/#setter) + + +#### Fluent Setters +set multiple part of jalali datetime
+ +```php +$v = verta(); // 1396-03-14 14:18:23 +echo $v->setTimeString('12:25:45'); +``` +[view more fluent setter](https://hekmatinasser.github.io/verta/#set_date_time) + + +### Formattingshow datetime variant datetime
```php -echo verta('-13 month')->formatDifference(); // 1 سال قبل +echo verta()->format('Y.m.d'); // 1401.05.24 echo verta()->formatWord('l dS F'); // دوشنبه بیست و چهارم مرداد -... ``` +[view more format](https://hekmatinasser.github.io/verta/#formatting) -show common datetime variant datetime
+ +```php +echo verta()->formatJalaliDatetime(); // output 1395/10/07 14:12:25 +``` +[view more common format](https://hekmatinasser.github.io/verta/#format_date_time) + + +### Difference for Humans +show difference format readable humans
+ +```php +echo verta('-13 month')->formatDifference(); // 1 سال قبل +``` +[view more format difference](https://hekmatinasser.github.io/verta/#format_difference) + +### Modificationmanipulate jalali datetime
```php echo verta()->addWeeks(3); ... ``` +[view more modifications](https://hekmatinasser.github.io/verta/#modification) -get boundary jalali datetime
```php echo verta()->startWeek(3); -... ``` +[view more boundaries](https://hekmatinasser.github.io/verta/#boundaries) -calculate diff two jalali datetime
+### Compression +get compression jalali datetime
+ +```php +echo verta('+2 day')->gte('2022-08-15'); +``` +[view more compression](https://hekmatinasser.github.io/verta/#comparison) + + +#### Difference +calculate difference two jalali datetime
```php echo verta('+13 day')->diffMonths('2022-08-15'); -... ``` +[view more differences](https://hekmatinasser.github.io/verta/#comparison) -get boundary jalali datetime
+### Validation +check datetime check is valid
```php -echo verta('+2 day')->gte('2022-08-15'); -... +echo Verta::isLeapYear(1394); // false ``` +[view more validations](https://hekmatinasser.github.io/verta/#validation) -set language for formatting datetime
+ +```php +Verta::setLocale('ar'); +``` +[view more localizations](https://hekmatinasser.github.io/verta/#translation) + + +### Validation Requestvalidation input form
```php 'birthday' => ['required', 'jdate_before_equal'] -... ``` +[view more localizations](https://hekmatinasser.github.io/verta/#laravel_validation) + + ## Licence This package has been created by Nasser Hekmati under the license of MIT. ## Contributors -Thanks to people who contributed for grow varta. +Thanks to people who contributed for grow verta.calculate difference two jalali datetime
```php echo verta('+13 day')->diffMonths('2022-08-15'); ``` -[view more differences](https://hekmatinasser.github.io/verta/#comparison) +[view more differences](https://hekmatinasser.github.io/verta/#difference) ### Validationcheck datetime check is valid
@@ -204,7 +204,7 @@ echo Verta::isLeapYear(1394); // false ```php Verta::setLocale('ar'); ``` -[view more localizations](https://hekmatinasser.github.io/verta/#translation) +[view more localizations](https://hekmatinasser.github.io/verta/#localization) ### Validation Request