Skip to content

Commit

Permalink
Add another test case for .vcf
Browse files Browse the repository at this point in the history
This one uses a slightly different format of date.
  • Loading branch information
dfandrich committed Jul 25, 2024
1 parent ecf1ecb commit ea1de1b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion automtime
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test-automtime-expected
Original file line number Diff line number Diff line change
Expand Up @@ -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'
11 changes: 11 additions & 0 deletions testfiles/type3.vcf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ea1de1b

Please sign in to comment.