Skip to content

[6.x] Convert date bindings to app timezone in raw SQL dump#14937

Open
marcorieser wants to merge 1 commit into
statamic:6.xfrom
marcorieser:fix/raw-sql-date-timezone
Open

[6.x] Convert date bindings to app timezone in raw SQL dump#14937
marcorieser wants to merge 1 commit into
statamic:6.xfrom
marcorieser:fix/raw-sql-date-timezone

Conversation

@marcorieser

Copy link
Copy Markdown
Contributor

After passing a Carbon instance with a timezone other than UTC to a where() clause, I was confused as to why the dates in the fake query didn't show the correct time.

This PR fixes toRawSql() / raw SQL dumping so DateTimeInterface bindings (e.g. Carbon instances) are converted to the app timezone before being interpolated into the dumped SQL string. Previously, the raw SQL output could show a date/time in whatever timezone the value happened to be in, which didn't match what's actually sent to the database.

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.

1 participant