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

Fix/datetime filter fix #1316

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

VitaliyChaban
Copy link

fix error:
Cannot write DateTime with Kind=Unspecified to PostgreSQL type 'timestamp with time zone', only UTC is supported

also:
#1223
#1033
#378

@VitaliyChaban
Copy link
Author

Yes, I accept the agreement. What do I need to do for this?

@microsoft-github-policy-service agree company="DexTechnology"

@VitaliyChaban
Copy link
Author

Can someone review the changes and approve the pull request?
There are very few changes, just one line not counting the auto-test. In terms of functionality, it only affects the date filtering with time and nothing else.

@VitaliyChaban
Copy link
Author

VitaliyChaban commented Sep 23, 2024

I added a more accurate setter for 'Kind' depending on TimeZoneInfo in the settings.
All tests are passing, and there are new tests.

private static DateTimeKind GetTargetDateTimeKind(TimeZoneInfo timeZone)
    {
        if (timeZone.Equals(TimeZoneInfo.Local))
            return DateTimeKind.Local;

        if (timeZone.Equals(TimeZoneInfo.Utc))
            return DateTimeKind.Utc;

        return DateTimeKind.Unspecified;
    }
DateTimeOffset dateTimeOffsetValue = (DateTimeOffset)value;
TimeZoneInfo timeZone = timeZoneInfo ?? TimeZoneInfo.Local;

dateTimeOffsetValue = TimeZoneInfo.ConvertTime(dateTimeOffsetValue, timeZone);

var dateTimeKind = GetTargetDateTimeKind(timeZone);

return DateTime.SpecifyKind(dateTimeOffsetValue.DateTime, dateTimeKind);

@VitaliyChaban
Copy link
Author

@xuzhg

Could you please let me know how often you conduct releases and when we can expect a new version with this fix? Will we have to wait for a scheduled release for some time, or can a version with these changes be released earlier (perhaps as a release candidate or something similar)?

@6wanted9
Copy link

6wanted9 commented Nov 6, 2024

Hello! Any updates on this issue?

@6wanted9
Copy link

6wanted9 commented Nov 6, 2024

@habbes @xuzhg take a look, please

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.

3 participants