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

Translation error when storing NodaTime (Instant, TimeZoneId) and filtering on local date time values #3197

Closed
thj-dk opened this issue Jun 9, 2024 · 1 comment

Comments

@thj-dk
Copy link

thj-dk commented Jun 9, 2024

I'm attempting to achieve the following query using the latest NodaTime and EF Core packages:

select * from "TimeEntries"
where "Date_Instant" at time zone "Date_Tz" >= '2024-06-10'

This is my attempt:

await db.TimeEntries
  .Where(e =>
    e.Date.Instant.InZone(DateTimeZoneProviders.Tzdb[e.Date.Tz]).LocalDateTime > local)
  .ToListAsync();

e.Date.Tz is of course a string representing a Tzdb timezone identifier, e.g. "Pacific/Auckland".

The error returned is "Translation of method 'NodaTime.Instant.InZone' failed."

It this possible or are there better ways to achieve this?

@thj-dk thj-dk changed the title Translation error when storing (Instant, TimeZoneId) and filtering on local date time values Translation error when storing NodaTimes (Instant, TimeZoneId) and filtering on local date time values Jun 9, 2024
@thj-dk thj-dk changed the title Translation error when storing NodaTimes (Instant, TimeZoneId) and filtering on local date time values Translation error when storing NodaTime (Instant, TimeZoneId) and filtering on local date time values Jun 9, 2024
@thj-dk
Copy link
Author

thj-dk commented Jun 10, 2024

Closed. This already works. My fault.

@thj-dk thj-dk closed this as completed Jun 10, 2024
@roji roji closed this as not planned Won't fix, can't repro, duplicate, stale Jun 10, 2024
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

No branches or pull requests

2 participants