Page 1 of 1

Date Token Returns Wrong Data

PostPosted: 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!!

Re: Date Token Returns Wrong Data

PostPosted: 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.

Re: Date Token Returns Wrong Data

PostPosted: 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

Re: Date Token Returns Wrong Data

PostPosted: 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.

Re: Date Token Returns Wrong Data

PostPosted: 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.

Re: Date Token Returns Wrong Data

PostPosted: 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.