filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.

Home Page:https://filamentphp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mutate Record Data

tareq-alqadi opened this issue · comments

Package

filament/filament

Package Version

v3

Laravel Version

v10

Livewire Version

v3

PHP Version

PHP 8.2

Problem description

When using the mutateRecordDataUsing method in EditAction, if the model has a date cast, it is always returned in UTC time zone, even if the Laravel app config time zone is set to something else.
This happened because of using attributesToArray method to get model data which use serializeDate method which use toJSON to return "the ISO-8601 string (ex: 1977-04-22T06:00:00Z) with UTC timezone".

Expected behavior

This is more of an unexpected behavior than a bug, but I think it should return the date in the same time zone as in my app configuration.

Steps to reproduce

Create model with date cast, then use EditAction to edit any record and use mutateRecordDataUsing

Reproduction repository

https://github.com/filamentphp/demo

Relevant log output

No response

The code is not present in the reproduction repository