Closed DWesl closed 5 months ago
Thanks @DWesl And thanks for adding a test.
Just as an FYI, we would like to deprecate the use of finddate.sh
and promote the use of the standard Linux date
utility.
As of now, a search on uses of finddate.sh
does not yield a hit, so please bear this information in mind.
The old code handled one month boundary, so it could add sixty days to 2021-05-01 to get 2021-06-30, but adding 62 days would produce 2021-06-32. These changes allow the script to work when requesting dates twenty years ahead or behind the given date.
I also updated the leap-year calculation from Julian to Gregorian, which will annoy people running forecasts pre-1500 and help people running forecasts in 1900 or 2100.
I added some tests to be sure this was working, including one to ensure the output is the same as the old version. My version has a trailing space at the end of all sequences of dates, but that looks the same as the old version.