Skip to content

Differences for ranges #30

@choptastic

Description

@choptastic

Qdate could benefit from more date arithmetic in the sense of finding out the difference between two dates.

difference_days(Date1, Date2) would return the number of days between those two dates.

difference_minutes(Date1, Date2) would do the same (though this is easy because of the easy conversion to unix timestamps - same with seconds (obviously), hours.

calculating differences of days with respect is more complicated if a range crosses a daylight savings time.

My gut is telling me that the answer to both is to strip off any time component and use just dates, then convert to gregorian days with calendar:date_to_gregorian_days(Date). From there, the math is simple. Maybe the time component could then be re-added to the original dates and the time component compared to retrieve the fractional part of a day with compared times.

Something to chew on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions