Skip to content

Support Range<NaiveDate> for daterange #18

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

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

Conversation

the-kenny
Copy link

This implements Normalizable for NaiveDate to support Range<Date>. It also changes assert! to assert_eq! in a few places to improve the test output.

Note that I had to #[ignore] the new test I added because Postgres normalises (2023-01-01,) to [2023-01-02,), which makes the test fail as test_types does a by-value comparison.

> The built-in range types int4range, int8range,
> and daterange all use a canonical form that
> includes the lower bound and excludes the upper
> bound; that is, [).

https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-DISCRETE

This is implemented by modifying the
`bounded_normalize` macro to take a `$delta`
expression (`1` for `i32` and `i64`,
`Duration::days(1)` for `NaiveDate`).
@the-kenny
Copy link
Author

@sfackler I finally got around to fixing Normalize :-) Could I ask you to have another look when your time permits?

@lgrosz
Copy link

lgrosz commented Mar 24, 2025

Will this get merged?

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