Invoice time support (#269)

* Changed invoice date to datetime

* Fixed code style errors

* Update TimeFormatsController.php

* Update TimeFormatter.php

* Update TimeFormatsController namespace

* Fix missing comma in language file

* Fix formatting

---------

Co-authored-by: troky <troky2001@yahoo.com>
This commit is contained in:
Darko Gjorgjijoski
2025-01-12 13:32:47 +01:00
committed by GitHub
parent 32e03b98a3
commit f52b73f517
14 changed files with 242 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Space;
use Carbon\Carbon;
class TimeFormatter
{
protected static $formats = [
[
'carbon_format' => 'H:i',
'moment_format' => 'HH:mm',
],
[
'carbon_format' => 'g:i a',
'moment_format' => 'h:mm a',
],
];
public static function get_list()
{
$new = [];
foreach (static::$formats as $format) {
$new[] = [
'display_time' => Carbon::now()->format($format['carbon_format']),
'carbon_format_value' => $format['carbon_format'],
'moment_format_value' => $format['moment_format'],
];
}
return $new;
}
}