|
|
|
@ -43,29 +43,6 @@ function formatDecimal($number) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Format date in indonesian format dd-mm-yyyy. |
|
|
|
* |
|
|
|
* @param string $date |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
function formatDate($date) |
|
|
|
{ |
|
|
|
if (!$date || $date == '0000-00-00') { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
$explodedDate = explode('-', $date); |
|
|
|
|
|
|
|
if (count($explodedDate) == 3 && checkdate($explodedDate[1], $explodedDate[0], $explodedDate[2])) { |
|
|
|
return $explodedDate[2].'-'.$explodedDate[1].'-'.$explodedDate[0]; |
|
|
|
} elseif (count($explodedDate) == 3 && checkdate($explodedDate[1], $explodedDate[2], $explodedDate[0])) { |
|
|
|
return $explodedDate[2].'-'.$explodedDate[1].'-'.$explodedDate[0]; |
|
|
|
} |
|
|
|
|
|
|
|
throw new App\Exceptions\InvalidDateException('Invalid date format.'); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Get Indonesian date format. |
|
|
|
* |
|
|
|
* @param string $date |
|
|
|
|