bug parse_date

This commit is contained in:
Jephté Clain 2022-04-06 08:38:44 +04:00
parent f7ab14ff7e
commit fb434c2a96
1 changed files with 2 additions and 2 deletions

View File

@ -391,7 +391,7 @@ function get_time_fr() {
}
function parse_date() {
local value="$1" type="${2:-date}"
local now="$(awk 'BEGIN { print mktime(strftime("%Y %m %d 00 00 00 +0400")) }')"
local now="$(awk 'BEGIN { print mktime(strftime("%Y %m %d 00 00 00")) }')"
case "$value" in
=*) value="${value#=}";;
+*) value="$(($now + ${value#+} * 86400))";;
@ -402,7 +402,7 @@ function parse_date() {
m = $2 + 0; if (m < 1) m = nm;
if ($3 == "") y = ny;
else { y = $3 + 0; if (y < 100) y = y + 2000; }
print mktime(sprintf("%04i %02i %02i 00 00 00 +0400", y, m, d));
print mktime(sprintf("%04i %02i %02i 00 00 00", y, m, d));
}')";;
esac
case "$type" in