Skip to content

Insufficient date validation in datediff #163

@rdiez

Description

@rdiez

It is difficult to use datediff in a robust manner. For example, dates that are obviously invalid are still accepted:

$ dateutils.ddiff  2024-1x-k3  2024-01-02
2

That happens even if a particular input format is specified:

$ dateutils.ddiff  --input-format="%d/%m/%Y"  2024-1x-k3  31/12/2024
366

It looks like datediff is applying the input formats only to the 2nd date specified, because this fails properly:

$ dateutils.ddiff  --input-format="%d/%m/%Y"  2024-1x-k2  2024-3x-k4
ddiff: cannot make sense of `2024-3x-k4' using the given input formats

I am using the datediff 0.4.5 which comes with Ubuntu 22.04.

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