Playing around with local date time parsing.

This commit is contained in:
James Cole
2024-11-09 20:38:30 +01:00
parent 0d11769590
commit 0ae5593dde
5 changed files with 19 additions and 5 deletions

View File

@@ -3,7 +3,6 @@
namespace FireflyIII\Casts;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
@@ -19,13 +18,11 @@ use Illuminate\Database\Eloquent\Model;
class SeparateTimezoneCaster implements CastsAttributes
{
/**
* Cast the given value.
*
* @param array<string, mixed> $attributes
*/
public function get(Model $model, string $key, mixed $value, array $attributes): ?Carbon
{
if('' === $value || null === $value) {
if ('' === $value || null === $value) {
return null;
}
$timeZone = $attributes[sprintf('%s_tz', $key)] ?? config('app.timezone');