Open minfrin opened 10 months ago
Hi, no there is not. Can you maybe use awk to do what you desire?
$ echo 4 | awk '$0 = $1 > 0 ? "Expires in "$1" days" : $1 < 0 ? "Expired " ""-$1" days ago" : "Expires today"'
Expires in 4 days
$ echo -4 | awk '$0 = $1 > 0 ? "Expires in "$1" days" : $1 < 0 ? "Expired " ""-$1" days ago" : "Expires today"'
Expired 4 days ago
Is there a way to show human readable date differences?
Most specifically, given the expiry date of a certificate, I can get raw output of number of days until expiry or after expiry, positive or negative.
Is there a way to provide separate formats for positive results (eg "Expires in $d days"), exact results (eg "Expires today), and negative results (eg "Expired 2 days ago")?