approxidate parsing for bad time units
From: Jeffrey Middleton <hidden>
Date: 2016-06-15 22:54:38
In telling someone what date formats git accepts, and how to verify it understands, I noticed this weirdness: $ export TEST_DATE_NOW=`date -u +%s --date='September 10'`; ./test-date approxidate now; for i in `seq 1 10`; do ./test-date approxidate "$i frobbles ago"; done now -> 2012-09-10 00:00:00 +0000 1 frobbles ago -> 2012-09-02 00:00:00 +0000 2 frobbles ago -> 2012-09-03 00:00:00 +0000 3 frobbles ago -> 2012-09-04 00:00:00 +0000 4 frobbles ago -> 2012-09-05 00:00:00 +0000 5 frobbles ago -> 2012-09-06 00:00:00 +0000 6 frobbles ago -> 2012-09-07 00:00:00 +0000 7 frobbles ago -> 2012-09-08 00:00:00 +0000 8 frobbles ago -> 2012-09-09 00:00:00 +0000 9 frobbles ago -> 2012-09-10 00:00:00 +0000 10 frobbles ago -> 2012-09-11 00:00:00 +0000 Which gets more concerning once you realize the same thing happens no matter what fake unit of time you use... including things like "yaers" and "moths". Perhaps approxidate could be a little stricter? Thanks, Jeffrey