Subject: Re: date -d greater than 23 years ago gives error invalid date

From: Mark Krenz <[email-masked]>
Date: Wed, 28 Apr 2021 21:14:33 +0000

Further investigating this problem it appears that at least today it
doesn't like going back past September 26th, 1997. But only when the
time delta is specified in years months or days.  You can go back
further if it's specified in total amounts of hours minutes or seconds.

$ date -d "now - 283 months"
Sun 28 Sep 1997 03:42:05 PM EST
$ date -d "now - 284 months"
date: invalid date ‘now - 284 months’

$ date -d "now - 283 months - 2 days"
Fri 26 Sep 1997 03:42:31 PM EST
$ date -d "now - 283 months - 3 days"
date: invalid date ‘now - 283 months - 3 days’

$ date -d "now - 8615 days"
Fri Sep 26 03:52:30 PM EST 1997
$ date -d "now - 8616 days"
date: invalid date ‘now - 8616 days’

$ date -d "now - 206804 hours"
Wed Sep 24 07:54:15 PM EST 1997

$ date -d "now - 12408240 minutes"
Wed Sep 24 08:03:50 PM EST 1997

$ date -d "now - 744590000 seconds"
Tue Sep 23 05:20:23 PM EST 1997

I don't see anything special about Sept 25th, 1997 in terms of it's
numeric value:

$ date -d "1997-09-25" +%s
875163600

Or the delta from now to then.

8615*86400 = 744336000

Very weird. I'll be curious to see what turns out to be the problem.  I
also found a system I'm running that has coreutils 8.30 and it did not
have the problem, so that narrows the gap a bit.

Mark