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

Replace CalendarDiffTime with a more useful type, like NominalDiffTime #308

Open
sir4ur0n opened this issue Feb 7, 2024 · 0 comments
Open

Comments

@sir4ur0n
Copy link

sir4ur0n commented Feb 7, 2024

Currently Rel8.Expr.Time treats durations (SQL type interval) as CalendarDiffTime.

The problem is that this type is rather useless.
E.g.:

  • you can't find the exact number of days this amounts to
  • you can't compare values of this type, only test equality
  • this type is undocumented

This type's only vaguely useful destructors are its fields ctMonths and ctTime, unfortunately ctMonths representing a number of months, one cannot find the duration it amounts to. CalendarDiffTime {ctMonths = 1, ctTime = fromInteger 0} has a different meaning (hence, duration value, hence number of days) between January and February vs between February and March.

How about switching to a more useful type, e.g. NominalDiffTime?
This type has many useful destructors, like Ord and Num instances (e.g. one can myNominalDiffTime / nominalDay to find the number of days).

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

1 participant