dateutils icon indicating copy to clipboard operation
dateutils copied to clipboard

Insufficient date validation in datediff

Open rdiez opened this issue 1 year ago • 2 comments

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.

rdiez avatar Oct 23 '24 19:10 rdiez