Skip to content

click.Date #2473

@jason-curtis

Description

@jason-curtis

click.DateTime is great, and you can use click.DateTime(formats=["%Y-%m-%d"]) to ensure that the value is logically just a date. However, the resulting object is still a datetime.datetime, which isn't ideal if you want to be dealing with pure dates.

Right now I'm working around this by using a click.DateTime() argument and doing start_date = start_date.date() at the top of my function, but that's not ideal because my team considers variable reassignment to be a code smell. I could rename the argument to something else, but that's also something of a kluge.

It'd be great to have a click.Date argument type that would act similarly to click.DateTime and return a date only.

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