From e8bb1b01953d6035beb3db1d038d74b722f50702 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 1 Dec 2023 12:33:06 +0100 Subject: [PATCH] fix from copy/paste --- datetime.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/datetime.sh b/datetime.sh index 3021895..f90e74a 100644 --- a/datetime.sh +++ b/datetime.sh @@ -8,13 +8,11 @@ isdate(){ then # y-m-d (ISO Date) y="${date%%-*}" d="${date##*-}" m="${date%-*}" m="${m#*-}" elif printf %s "$date" \ - | grep -xEq '((0?1|0?3|0?5|0?7|0?8|10|12)/(0?[1-9]|[12][0-9]|3[01])|(0?4|0?6|0?9|11)/(0?[1-9]|[12][0-9]|30)|0?2-(0[1-9]|[12][0-9]))/([0-9]{2}|[0-9]{4 -})' + | grep -xEq '((0?1|0?3|0?5|0?7|0?8|10|12)/(0?[1-9]|[12][0-9]|3[01])|(0?4|0?6|0?9|11)/(0?[1-9]|[12][0-9]|30)|0?2-(0[1-9]|[12][0-9]))/([0-9]{2}|[0-9]{4})' then # m/d/y (US Date) y="${date##*/}" m="${date%%/*}" d="${date%/*}" d="${d#*/}" elif printf %s "$date" \ - | grep -xEq '((0?[1-9]|[12][0-9]|3[01])[\./](0?1|0?3|0?5|0?7|0?8|10|12)|(0?[1-9]|[12][0-9]|30)[\./](0?4|0?6|0?9|11)|(0[1-9]|[12][0-9])[\./]0?2)[\./]( -[0-9]{2}|[0-9]{4})' + | grep -xEq '((0?[1-9]|[12][0-9]|3[01])[\./](0?1|0?3|0?5|0?7|0?8|10|12)|(0?[1-9]|[12][0-9]|30)[\./](0?4|0?6|0?9|11)|(0[1-9]|[12][0-9])[\./]0?2)[\./]([0-9]{2}|[0-9]{4})' then # d/m/y or d.m.y (European Date / German Date) y="${date##*.}" d="${date%%.*}" m="${date%.*}" m="${m#*.}" else -- 2.39.5