diff options
Diffstat (limited to 'Functions/Calendar/age')
-rw-r--r-- | Functions/Calendar/age | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Functions/Calendar/age b/Functions/Calendar/age index 8f6278fa2..17cf4d13e 100644 --- a/Functions/Calendar/age +++ b/Functions/Calendar/age @@ -18,7 +18,7 @@ # are allowed, but whitespace must be quoted to ensure age receives # the correct arguments. # -# AGEREF1=2006/10/04:10:15 +# AGEREF=2006/10/04:10:15 # AGEREF2=2006/10/04:10:45 # print *(+age) # @@ -33,21 +33,27 @@ zmodload -i zsh/parameter autoload -Uz calendar_scandate +local timefmt local -a vals tmp [[ -e $REPLY ]] || return 1 -zstat -A vals +mtime $REPLY || return 1 +zstat -A vals +mtime -- $REPLY || return 1 if (( $# >= 1 )); then if [[ $1 = :* ]]; then - zstat -A tmp -F "%Y/%m/%d" +mtime ${1[2,-1]} || return 1 + if (( $# > 1 )); then + timefmt="%Y/%m/%d:%H:%M:%S" + else + timefmt="%Y/%m/%d" + fi + zstat -A tmp -F $timefmt +mtime -- ${1#:} || return 1 local AGEREF=$tmp[1] else local AGEREF=$1 fi # if 1 argument given, never use globally defined AGEREF2 if [[ $2 = :* ]]; then - zstat -A tmp -F "%Y/%m/%d" +mtime ${2[2,-1]} || return 1 + zstat -A tmp -F "%Y/%m/%d:%H:%M:%S" +mtime -- ${2#:} || return 1 local AGEREF2=$tmp[1] else local AGEREF2=$2 |