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

DateTime Kind and Postgres #188

Closed
moxplod opened this issue Jul 24, 2024 · 4 comments
Closed

DateTime Kind and Postgres #188

moxplod opened this issue Jul 24, 2024 · 4 comments
Labels
bug Something isn't working entity framework Integration with entity-framework

Comments

@moxplod
Copy link
Contributor

moxplod commented Jul 24, 2024

Version

2.14.2

Details

Bringing this up from this issue - #134

And your quote -

Recognizing the importance of this issue, I am considering adding a setting/configuration in future versions that would allow users to choose the default DateTimeKind conversion. This feature would provide a more flexible and straightforward way to manage DateTime conversions according to individual project needs, reducing the necessity for manual adjustments via the GridifyMapper.

Without this setting, datetime filtering is broken in Postgres for Gridify, and I am unable to set this in Map as I have many DateTime (nullable and not nullable) properties across many entities.

Steps to reproduce

Use any datetime property (I tried it with a nullable datetime property).
Try filtering by datetime string.

We get the error - System.ArgumentException: 'timestamp with time zone' literal cannot be generated for Unspecified DateTime: a UTC DateTime is required

@moxplod moxplod added the bug Something isn't working label Jul 24, 2024
@alirezanet alirezanet added the entity framework Integration with entity-framework label Jul 25, 2024
@cirrusone
Copy link

You may find this post useful which relates to this Mapping .NET Timestamps to PostgreSQL

This lists all of the breaking changes from Npgsql 6.0 with explanations.

@moxplod
Copy link
Contributor Author

moxplod commented Jul 26, 2024

You may find this post useful which relates to this Mapping .NET Timestamps to PostgreSQL

This lists all of the breaking changes from Npgsql 6.0 with explanations.

I read that a while ago, and my application is using the new recommended NpgSql and .net behavior. timestamptz for columns and all the datetime properties are consistently passed as Kind Utc. Which is where this bug comes in - NpgSql throws an error when the string datetime is converted to unspecified kind by Gridify.

@moxplod
Copy link
Contributor Author

moxplod commented Aug 3, 2024

@alirezanet I will attempt to fix this and also complete #191
I would appreciate any pointers that would help me do either of these before I dive into the Gridify code (for the first time).

@moxplod
Copy link
Contributor Author

moxplod commented Aug 10, 2024

This was merged.

@moxplod moxplod closed this as completed Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working entity framework Integration with entity-framework
Projects
None yet
Development

No branches or pull requests

3 participants