Skip to content

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

@sir4ur0n

Description

@sir4ur0n

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions