add shipping rules
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Jenssegers\Date\Date;
|
||||
|
||||
use App\Repositories\Languages;
|
||||
|
||||
class DateTime
|
||||
{
|
||||
public static function getMonthName($date, $short = true)
|
||||
@@ -33,22 +31,24 @@ class DateTime
|
||||
public static function DatetoLocale($date = null)
|
||||
{
|
||||
$format = self::getLocaleFormatDate();
|
||||
if (!is_null($date) && !empty($date)) {
|
||||
if (! is_null($date) && ! empty($date)) {
|
||||
$date = Carbon::parse($date)->format($format);
|
||||
} elseif ($date == 'now') {
|
||||
$date = today()->format($format);
|
||||
}
|
||||
|
||||
return $date;
|
||||
}
|
||||
|
||||
public static function DatetimeToLocale($date = null)
|
||||
{
|
||||
$format = self::getLocaleFormatDatetime();
|
||||
if (!is_null($date) && !empty($date)) {
|
||||
if (! is_null($date) && ! empty($date)) {
|
||||
$date = Carbon::parse($date)->format($format);
|
||||
} elseif ($date == 'now') {
|
||||
$date = now()->format($format);
|
||||
}
|
||||
|
||||
return $date;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ class DateTime
|
||||
public static function convert($date)
|
||||
{
|
||||
$format = self::getLocaleFormatDate();
|
||||
return !empty($date) ? Carbon::createFromFormat($format, $date)->isoFormat('Y-MM-DD') : null;
|
||||
|
||||
return ! empty($date) ? Carbon::createFromFormat($format, $date)->isoFormat('Y-MM-DD') : null;
|
||||
}
|
||||
|
||||
public static function convertTime($date)
|
||||
@@ -79,17 +80,18 @@ class DateTime
|
||||
if (strlen($date) == 16) {
|
||||
$date .= ':00';
|
||||
}
|
||||
return !empty($date) ? Carbon::createFromFormat($format, $date)->isoFormat('Y-MM-DD HH:mm:ss') : null;
|
||||
|
||||
return ! empty($date) ? Carbon::createFromFormat($format, $date)->isoFormat('Y-MM-DD HH:mm:ss') : null;
|
||||
}
|
||||
|
||||
public static function toFr($date)
|
||||
{
|
||||
return !empty($date) ? Carbon::parse($date)->isoFormat('DD/MM/Y') : null;
|
||||
return ! empty($date) ? Carbon::parse($date)->isoFormat('DD/MM/Y') : null;
|
||||
}
|
||||
|
||||
public static function toFrTime($date)
|
||||
{
|
||||
return !empty($date) ? Carbon::parse($date)->isoFormat('DD/MM/Y HH:mm:ss') : null;
|
||||
return ! empty($date) ? Carbon::parse($date)->isoFormat('DD/MM/Y HH:mm:ss') : null;
|
||||
}
|
||||
|
||||
public static function getYearFromDate($date)
|
||||
@@ -97,10 +99,10 @@ class DateTime
|
||||
// return date_format(DateTime::convert($signature_date), 'Y');
|
||||
$date = DateTime::convert($date);
|
||||
$date = date_create($date);
|
||||
|
||||
return date_format($date, 'Y');
|
||||
}
|
||||
|
||||
|
||||
public static function getLocaleFormatDate()
|
||||
{
|
||||
$locale = self::getLang();
|
||||
@@ -112,6 +114,7 @@ class DateTime
|
||||
default:
|
||||
$format = 'Y-m-d';
|
||||
}
|
||||
|
||||
return $format;
|
||||
}
|
||||
|
||||
@@ -126,6 +129,7 @@ class DateTime
|
||||
default:
|
||||
$format = 'Y-m-d H:i:s';
|
||||
}
|
||||
|
||||
return $format;
|
||||
}
|
||||
|
||||
@@ -157,6 +161,7 @@ class DateTime
|
||||
public static function getISOFormat($format, $date = false)
|
||||
{
|
||||
$date = $date ? $date : now();
|
||||
|
||||
return Carbon::parse($date)->isoFormat($format);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user