add nullabe option compare date
This commit is contained in:
1 parent
b67d61b056
commit
acb2293588
4 files changed
+33
-33
No files matched your search
+6
-6
@@ -321,12 +321,12 @@ return $v3->diffSeconds(); // 12261931
|
|||||||
```
|
```
|
||||||
To compere datetime together, use the following command
|
To compere datetime together, use the following command
|
||||||
```php
|
```php
|
||||||
echo $v1->eq($v2); // false equalTo()
|
echo $v1->eq(); // ture alias equalTo()
|
||||||
echo $v1->ne($v2); // true notEqualTo()
|
echo $v1->ne($v2); // true alias notEqualTo()
|
||||||
echo $v1->gt($v2); // true greaterThan()
|
echo $v1->gt($v2); // true alias greaterThan()
|
||||||
echo $v1->gte($v2); // true greaterThanOrEqualTo()
|
echo $v1->gte($v2); // true alias greaterThanOrEqualTo()
|
||||||
echo $v1->lt($v2); // false lessThan()
|
echo $v1->lt($v2); // false alias lessThan()
|
||||||
echo $v1->lte($v2); // false lessThanOrEqualTo()
|
echo $v1->lte($v2); // false alias lessThanOrEqualTo()
|
||||||
echo $v1->between($v2, $v3); // false
|
echo $v1->between($v2, $v3); // false
|
||||||
```
|
```
|
||||||
To compere datetime for closest, farthest, min or max together, use the following command
|
To compere datetime for closest, farthest, min or max together, use the following command
|
||||||
|
|||||||
@@ -321,12 +321,12 @@ return $v3->diffSeconds(); // 12261931
|
|||||||
```
|
```
|
||||||
برای مقایسه تاریخ ها با یکدیگر، از دستور زیر استفاده کنید
|
برای مقایسه تاریخ ها با یکدیگر، از دستور زیر استفاده کنید
|
||||||
```php
|
```php
|
||||||
echo $v1->eq($v2); // false equalTo()
|
echo $v1->eq(); // ture alias equalTo()
|
||||||
echo $v1->ne($v2); // true notEqualTo()
|
echo $v1->ne($v2); // true alias notEqualTo()
|
||||||
echo $v1->gt($v2); // true greaterThan()
|
echo $v1->gt($v2); // true alias greaterThan()
|
||||||
echo $v1->gte($v2); // true greaterThanOrEqualTo()
|
echo $v1->gte($v2); // true alias greaterThanOrEqualTo()
|
||||||
echo $v1->lt($v2); // false lessThan()
|
echo $v1->lt($v2); // false alias lessThan()
|
||||||
echo $v1->lte($v2); // false lessThanOrEqualTo()
|
echo $v1->lte($v2); // false alias lessThanOrEqualTo()
|
||||||
echo $v1->between($v2, $v3); // false
|
echo $v1->between($v2, $v3); // false
|
||||||
```
|
```
|
||||||
برای بررسی تاریخ از لحاظ نزدیکتر یا دورتر بودن و یا کوچکتر و بزرگتر بودن، از دستور زیر استفاده کنید
|
برای بررسی تاریخ از لحاظ نزدیکتر یا دورتر بودن و یا کوچکتر و بزرگتر بودن، از دستور زیر استفاده کنید
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class JalaliValidator
|
|||||||
}
|
}
|
||||||
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d';
|
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d';
|
||||||
try {
|
try {
|
||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : new Verta();
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
return Verta::parseFormat($format, $value)->greaterThan($base);
|
return Verta::parseFormat($format, $value)->greaterThan($base);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
@@ -55,7 +55,7 @@ class JalaliValidator
|
|||||||
}
|
}
|
||||||
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d H:i:s';
|
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d H:i:s';
|
||||||
try {
|
try {
|
||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : new Verta();
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
return Verta::parseFormat($format, $value)->greaterThan($base);
|
return Verta::parseFormat($format, $value)->greaterThan($base);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
@@ -69,7 +69,7 @@ class JalaliValidator
|
|||||||
}
|
}
|
||||||
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d';
|
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d';
|
||||||
try {
|
try {
|
||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : new Verta();
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
return Verta::parseFormat($format, $value)->lessThan($base);
|
return Verta::parseFormat($format, $value)->lessThan($base);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
@@ -83,7 +83,7 @@ class JalaliValidator
|
|||||||
}
|
}
|
||||||
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d H:i:s';
|
$format = count($parameters) > 1 ? $parameters[1] : 'Y/m/d H:i:s';
|
||||||
try {
|
try {
|
||||||
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : new Verta();
|
$base = count($parameters) > 0 ? Verta::parseFormat($format, $parameters[0]) : null;
|
||||||
return Verta::parseFormat($format, $value)->lessThan($base);
|
return Verta::parseFormat($format, $value)->lessThan($base);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+17
-17
@@ -1578,9 +1578,9 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function eq(Verta $v)
|
public function eq(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this == $v;
|
return $this == ($v ?: new static());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1592,7 +1592,7 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function equalTo(Verta $v)
|
public function equalTo(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this->eq($v);
|
return $this->eq($v);
|
||||||
}
|
}
|
||||||
@@ -1604,7 +1604,7 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function ne(Verta $v)
|
public function ne(Verta $v = null)
|
||||||
{
|
{
|
||||||
return !$this->eq($v);
|
return !$this->eq($v);
|
||||||
}
|
}
|
||||||
@@ -1618,7 +1618,7 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function notEqualTo(Verta $v)
|
public function notEqualTo(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this->ne($v);
|
return $this->ne($v);
|
||||||
}
|
}
|
||||||
@@ -1630,9 +1630,9 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function gt(Verta $v)
|
public function gt(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this > $v;
|
return $this > ($v ?: new static());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1644,7 +1644,7 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function greaterThan(Verta $v)
|
public function greaterThan(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this->gt($v);
|
return $this->gt($v);
|
||||||
}
|
}
|
||||||
@@ -1656,9 +1656,9 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function gte(Verta $v)
|
public function gte(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this >= $v;
|
return $this >= ($v ?: new static());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1670,7 +1670,7 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function greaterThanOrEqualTo(Verta $v)
|
public function greaterThanOrEqualTo(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this->gte($v);
|
return $this->gte($v);
|
||||||
}
|
}
|
||||||
@@ -1682,9 +1682,9 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function lt(Verta $v)
|
public function lt(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this < $v;
|
return $this < ($v ?: new static());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1696,7 +1696,7 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function lessThan(Verta $v)
|
public function lessThan(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this->lt($v);
|
return $this->lt($v);
|
||||||
}
|
}
|
||||||
@@ -1708,9 +1708,9 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function lte(Verta $v)
|
public function lte(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this <= $v;
|
return $this <= ($v ?: new static());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1722,7 +1722,7 @@ class Verta extends DateTime {
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function lessThanOrEqualTo(Verta $v)
|
public function lessThanOrEqualTo(Verta $v = null)
|
||||||
{
|
{
|
||||||
return $this->lte($v);
|
return $this->lte($v);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user