Skip to content

Proposal: Merge datestuff library into dateutil #431

@justanr

Description

@justanr

I have a small library of date/datetime helpers (creatively called datestuff that I'd like to donate to this library. I often find myself installing both side by side and I feel the tools in datestuff are a good fit for dateutils' goal of "Useful extensions to the standard Python datetime features"

A quick rundown:

  • RelativeDate and RelativeDateTime provide "unfixed" dates/datetimes. What this means is that when the class is created, it's not tied to a specific instance in time but rather to an offset. Allowing a user to create a date that is always 1 week from now is as easy as RelativeDateTime(offset=timedelta(days=7)) rather than needing to deal with datetime.now() + timedelta(days=7) all over the place, the added benefit is that these can be used where ever regular date/datetime objects are. They also accept a factory if a different date/datetime object is desired. RelativeDate(Time) is already compatible with relativedelta as well.

  • DateRange is a range of date/datetimes modeled after Python 3's range so it is lazy, slicing it results in a new range rather than a list and has fast path membership testing. I've never found a helper than scratched this itch for me. The existing rrule is nice, but seems more suitable for complex calendar scheduling than a range of dates. Where as DateRange is simple to use: Just give it a start date, an optional end date, and a timedelta to step by. I will say allowing both fixed and infinite ranges from the same object was probably a mistake and it does complicate the code some.

  • within_delta is helper I wrote because I got tired of normalizing datetimes before comparing them.

If any copyright/license stuff needs to be signed over, I'm happy to do that (never done something like before).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions