Date Token Returns Wrong Data

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Date Token Returns Wrong Data Sat Aug 19, 2023 6:33 pm • by bmhardy
My Hazel rule examines a PDF file looking for, among other things, content contains match <token name>. The token is specified to be "Automatically detect date format". The date that it finds is "04/08/2021". When I use the token in renaming the file, it is reported as "2023-08-21". There is no date in the file that can be interpreted in that way, as you might suspect, since the file was generated in 2021. I examined the file in Text Edit to discover that.

This same thing happens on one other file. The files are pretty much the same and exactly the same with the date. One file is reporting information on me and the other file is reporting information on my wife. Both files come from the same insurance company.

Spotlight searching for the text "04/08/2021" finds the file.

Help!!
bmhardy
 
Posts: 7
Joined: Fri Feb 17, 2017 7:30 pm

Re: Date Token Returns Wrong Data Mon Aug 21, 2023 8:42 am • by Mr_Noodle
Can you post a screenshot of the preview in Hazel? If you click on the green x for the Contents contain match condition, it will show you the contents along with the text in the document it matched.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Date Token Returns Wrong Data Mon Aug 21, 2023 5:27 pm • by bmhardy
I made one of the conditions fail, so that the file would not be renamed or moved. So I could preview it. Hopefully the DropBox sharing link below will let you see the screen shot.

https://www.dropbox.com/scl/fi/prfg6va8 ... 06jwq&dl=0
bmhardy
 
Posts: 7
Joined: Fri Feb 17, 2017 7:30 pm

Re: Date Token Returns Wrong Data Tue Aug 22, 2023 8:40 am • by Mr_Noodle
Can you click on the ellipses (three dots) to expand that view? Try and find where the text is highlighted.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Date Token Returns Wrong Data Tue Aug 22, 2023 1:56 pm • by bmhardy
It looks like the selected date is "Monday-Friday". I guess that would explain the current date. Here's the Dropbox link

https://www.dropbox.com/s/j3s1ven8l0c9s ... M.png?dl=0

I changed the date format to specifically look for MM/DD/YYYY, and it worked. I was not aware that "Monday-Friday" would be found as a date format.

I learned some good debugging texts through this.

Thanks.
bmhardy
 
Posts: 7
Joined: Fri Feb 17, 2017 7:30 pm

Re: Date Token Returns Wrong Data Wed Aug 23, 2023 9:10 am • by Mr_Noodle
The automatic date detection is the same as what Apple uses to detect dates in places like Mail. I try to filter out ones that are all text but it doesn't catch everything. I'll try and tweak that in a future release.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support