Skip to content

Conversation

@miken32
Copy link
Contributor

@miken32 miken32 commented Aug 9, 2024

Resolves #3156 and lets the transformer deal with date formatting as intended.

@yajra
Copy link
Owner

yajra commented Aug 11, 2024

@miken32 the patch is intended for Collection, right? I tried using an Eloquent model with a date but the serialization is still the same and returns something like 2024-08-11T10:23:57.000000Z where the expectation is 2024-08-11 10:23:57.

@miken32
Copy link
Contributor Author

miken32 commented Aug 13, 2024

The update was to the helper class so I would have expected it to apply to both, but I was unable to check with a query builder instance as easily. Looking closer, I wonder if it's exiting Helper::convertToArray() early due to that first code block looking for ignore_getters?

@sonarqubecloud
Copy link

@yajra
Copy link
Owner

yajra commented Aug 17, 2024

The patch only applies to collection/array data sources.

For Eloquent, it is converted to an array thus making the model date serializer take effect. This explains why we still get 2024-08-11T10:23:57.000000Z when using an eloquent data source.

@yajra yajra merged commit d57a643 into yajra:master Aug 17, 2024
@yajra
Copy link
Owner

yajra commented Aug 17, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle DateTime values better

2 participants