Closed aidanharan closed 1 month ago
I have something that may or may not be related to this. I have the same problems with dates. When I do this:
MyModel.where(updated_at: (10.days.ago.to_date...Date.tomorrow)).to_sql
I get this answer:
SELECT [my_models].* FROM [my_models] WHERE [my_models].[updated_at] >= '10-05-2024' AND [my_models].[updated_at] < '10-16-2024'"
However, I do not use american date formats. And I don't believe I am setting that anywhere. So maybe the problems is that dates do not default to iso-format as they used to?
@nielsjansendk: I think, if you don't set the format explicitly anywhere in your codebase, the format is fetched from the SQL Server.
Maybe you can run DBCC USEROPTIONS
on your SQL Server and post the value of option dateformat
here?
Or, if you are using Azure, the dateformat
is fetched via SELECT [dateformat] FROM [sys].[syslanguages] WHERE [langid] = @@LANGID
So maybe the problems is that dates do not default to iso-format as they used to?
Was this the case, that default was iso format? I don't see this anywhere in the last few versions of the adapter.
Originally posted by @aaronsajo in https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/1166#issuecomment-2404977768