diff options
Diffstat (limited to 'bin/when.y')
-rw-r--r-- | bin/when.y | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/when.y b/bin/when.y index c94c5514..46651ebb 100644 --- a/bin/when.y +++ b/bin/when.y @@ -121,7 +121,10 @@ static struct tm dateDiff(struct tm a, struct tm b) { .tm_mon = a.tm_mon - b.tm_mon, .tm_mday = a.tm_mday - b.tm_mday, }; - if (a.tm_mon < b.tm_mon) { + if ( + a.tm_mon < b.tm_mon || + (a.tm_mon == b.tm_mon && a.tm_mday < b.tm_mday) + ) { diff.tm_year--; diff.tm_mon += 12; } |