-
Notifications
You must be signed in to change notification settings - Fork 226
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
DateOnly - en_GB date flipped from October to April. #3225
Comments
Are you sure the reversal is not purely in the parameter logging that you're seeing? Have you verified that the values are actually wrong (e.g. in the database)? Either way, can you please put together a minimal, runnable console program that shows the problem occurring? That's always needed with any bug report. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running .NET 8 with Npgsql 8.0.3.
The locale on my machine is en_GB as I'm based in the UK.
The PostgreSQL server’s locale in Azure is en_US.utf8 and I don’t believe I can change it.
I have some fairly simple code which is filtering a column of type "Date" in based on a DateOnly? value being passed in to a method:
The from date being specified is: 4th October 2023.
When I then call .ToQueryString() I can see that the query has changed to become instead: 10/04/2023.
Which I believe is then being interpreted as 10th April 2023 instead of 4th October 2023 giving me the wrong results from the database.
I've tried changing the thread culture of my code to be en-US. Wondering if this would give me the correct result. It doesn't.
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Is there some other trick if I cannot change the locale of the database? Is there some other setting I'd need to provide to prevent my date from being mis-interpreted?
Apologies if this is really trivial.
The text was updated successfully, but these errors were encountered: