From ea1de1b4b9511b4a0004e1876371c409219f650f Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 25 Jul 2024 12:52:53 -0700 Subject: [PATCH] Add another test case for .vcf This one uses a slightly different format of date. --- automtime | 4 +++- test-automtime-expected | 1 + testfiles/type3.vcf | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 testfiles/type3.vcf diff --git a/automtime b/automtime index 6512caf..b28fcb2 100755 --- a/automtime +++ b/automtime @@ -814,7 +814,9 @@ mtime_vbox () { # File type: vcf (vCard contact) mtime_vcf () { RAWTIME=$(sed -E -n -e 's/^REV:([^()]*)(\(.*\))?$/\1/p' <"$1" | sort | tail -1) - # $RAWTIME is like 2017-05-10T14:34:50Z + # $RAWTIME is like 2017-05-10T14:34:50Z or 20180213T070722Z + # Make sure it look like ISO-8601, then convert + RAWTIME=$(echo "$RAWTIME" | sed -E -e 's/([12][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])T([0-2][0-9])([0-9][0-9])([0-9][0-9])/\1-\2-\3T\4:\5:\6/') if [ -n "$RAWTIME" -a "$RAWTIME" != "0" ]; then TIME=$(normalize_iso_time "$RAWTIME") fi diff --git a/test-automtime-expected b/test-automtime-expected index 91fe594..edc2bbd 100644 --- a/test-automtime-expected +++ b/test-automtime-expected @@ -76,3 +76,4 @@ 'testfiles/type2.png' '2021-10-11 12:34:56 +0000' 'testfiles/type2.zip' '2021-10-15 06:16:44' 'testfiles/type3.gpx' '2003-11-29 10:11:22 +0000' +'testfiles/type3.vcf' '2008-10-31 06:58:54 +0000' diff --git a/testfiles/type3.vcf b/testfiles/type3.vcf new file mode 100644 index 0000000..dec7036 --- /dev/null +++ b/testfiles/type3.vcf @@ -0,0 +1,11 @@ +BEGIN:VCARD +VERSION:3.0 +FN:From Android +N:And;Roid;;; +TEL;TYPE=PREF;TYPE=VOICE:0300000000 +CLASS:PUBLIC +X-GNO:0 +X-GN:group0 +X-REDUCTION:0 +REV:20081031T065854Z +END:VCARD