fix devops error
This commit is contained in:
@@ -47,9 +47,9 @@ class DateTime
|
||||
public static function datetoLocale($date = null)
|
||||
{
|
||||
$format = self::getLocaleFormatDate();
|
||||
if (! is_null($date) && ! empty($date)) {
|
||||
if ($date) {
|
||||
$date = Carbon::parse($date)->format($format);
|
||||
} elseif ($date === 'now') {
|
||||
} else {
|
||||
$date = today()->format($format);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class DateTime
|
||||
public static function datetimeToLocale($date = null)
|
||||
{
|
||||
$format = self::getLocaleFormatDatetime();
|
||||
if (! is_null($date) && ! empty($date)) {
|
||||
if ($date) {
|
||||
$date = Carbon::parse($date)->format($format);
|
||||
} elseif ($date === 'now') {
|
||||
$date = now()->format($format);
|
||||
@@ -82,51 +82,50 @@ class DateTime
|
||||
$date .= ':00';
|
||||
}
|
||||
|
||||
return ! empty($date) ? Carbon::createFromFormat($format, $date) : null;
|
||||
return $date ? Carbon::createFromFormat($format, $date) : null;
|
||||
}
|
||||
|
||||
public static function getCarbonDate($date)
|
||||
{
|
||||
$format = self::getLocaleFormatDate();
|
||||
|
||||
return ! empty($date) ? Carbon::createFromFormat($format, $date) : null;
|
||||
return $date ? Carbon::createFromFormat($format, $date) : null;
|
||||
}
|
||||
|
||||
public static function convert($date)
|
||||
{
|
||||
return ! empty($date) ? self::getCarbonDate($date)->isoFormat('Y-MM-DD') : null;
|
||||
return $date ? self::getCarbonDate($date)->isoFormat('Y-MM-DD') : null;
|
||||
}
|
||||
|
||||
public static function convertTime($date)
|
||||
{
|
||||
return ! empty($date) ? self::getCarbonTime($date)->isoFormat('Y-MM-DD HH:mm:ss') : null;
|
||||
return $date ? self::getCarbonTime($date)->isoFormat('Y-MM-DD HH:mm:ss') : null;
|
||||
}
|
||||
|
||||
public static function toLocale($date)
|
||||
{
|
||||
$format = self::getLocaleFormatDate();
|
||||
|
||||
return ! empty($date) ? Carbon::parse($date)->Format($format) : null;
|
||||
return $date ? Carbon::parse($date)->Format($format) : null;
|
||||
}
|
||||
|
||||
public static function toISO($date)
|
||||
{
|
||||
return ! empty($date) ? Carbon::parse($date)->isoFormat('Y-MM-DD') : null;
|
||||
return $date ? Carbon::parse($date)->isoFormat('Y-MM-DD') : null;
|
||||
}
|
||||
|
||||
public static function toFr($date)
|
||||
{
|
||||
return ! empty($date) ? Carbon::parse($date)->isoFormat('DD/MM/Y') : null;
|
||||
return $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 $date ? Carbon::parse($date)->isoFormat('DD/MM/Y HH:mm:ss') : null;
|
||||
}
|
||||
|
||||
public static function getYearFromDate($date)
|
||||
{
|
||||
// return date_format(DateTime::convert($signature_date), 'Y');
|
||||
$date = self::convert($date);
|
||||
$date = date_create($date);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user