Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String datetime changes may break custom DateTimeType implementations #56

Open
cschomburg opened this issue Nov 19, 2020 · 1 comment
Open

Comments

@cschomburg
Copy link

In our application we are using a custom Cake\Database\Type\DateTimeType::marshal() that extends the default CakePHP database type. Our implementation basically interprets strings with no timezone information as being in the user's local timezone.

Upgrading to audit-stash 3.0.2 causes timezone issues with the created timestamp in our application. Previously we received a \DateTime object which we handled correctly. Now, due to the changes in #48, we only receive a string Y-m-d H:i:s with no timezone information given, and our application interprets this as the wrong timezone.

I'm not sure if this is expected behavior and our application is simply at fault for interpreting them differently than UTC. But in any case, this looks like a behavior change which we cannot easily work around due to the tz information loss.

Modifying the type check in #48 to handle inherited classes would solve our issue, but I don't know if this breaks the original authors intent:

if (!is_subclass_of(Type::getMap('datetime'), DateTimeType::class)) {

Or maybe this should be configurable behavior. Any ideas on how to proceed here?

@dereuromark
Copy link
Collaborator

Configurable sounds best for the moment
A PR here would be welcome.

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

No branches or pull requests

2 participants