Recognizing international date formats

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

Moderator: Mr_Noodle

Recognizing international date formats Sun Jan 17, 2021 11:06 am • by mkalina
I use and love Hazel. There is one thing, though, which is a problem for years and I am posting here to find out, whether someone knows either the solution to my problem or if there is a workaround. This is the problem:

I very often use Hazel to sort invoices into "subfolder by date". I work on a German language system and 90% of the time, there is no problem with date-matching as dates on invoices are written in numbers (like 2021-01-17). But sometimes, they are not. Then the fun begins:

Yesterday I got an invoice, dated like this "Invoice: Jan 16, 2021". Naturally I would create a new rule and with "content contain match" I would build a custom date-matching-token with short month name, space, day, comma, space, year. But here is the problem. On my German macOS, there is no way to define a 3-letter-month without a dot after that, so I can never match a date written like this. No matter what I do, the date-matching my system provides would always be: "Jan. 16, 2021" and since my invoice does not have that dot written there, there is no match and I cannot sort.

Is there a way to match even this kind of date? I thought of custom tokens, etc., but afaik there is no way to then use a number and convert it into a month.
mkalina
 
Posts: 11
Joined: Sat Nov 16, 2013 10:48 am

Re: Recognizing international date formats Mon Jan 18, 2021 11:31 am • by Mr_Noodle
Have you tried it? I added code to match with and without the dot since that was annoying so if it isn't working, let me know.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hi,

I'm running into a similar issue. I'm an expat in France so I have a lot of documents in US formats along with some French ones as well. Most of them I can deal with but, once in a while, there are some French ones that use odd formatting styles that I haven't been able to get Hazel to work with. The current one I'm dealing with always carries the statement date as like so:

27 JANVIER 2021


My system is using US locale with an override to use temperatures in ºC. I do have English in settings as my primary language along with French (and Spanish too). Do you have suggestion for detecting this format in a document?

Thank you
nedinfrance
 
Posts: 3
Joined: Wed Jan 27, 2021 12:13 pm

Re: Recognizing international date formats Thu Jan 28, 2021 11:15 am • by Mr_Noodle
Are you using automatic date detection or specifying a pattern?
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Recognizing international date formats Fri Jan 29, 2021 4:59 pm • by rchrd
I have the same problem (but only with Dutch).

For example the name of the month is Juni instead of June.

I tried both the option to detect date format and specified the date format but neither works.
rchrd
 
Posts: 4
Joined: Tue Jul 14, 2020 2:05 am

Re: Recognizing international date formats Fri Jan 29, 2021 5:07 pm • by rchrd
Perhaps I found a workaround; the months in English and Dutch start with the same characters. So I created a date pattern "Day Month Anything Year" and that seems to work.
rchrd
 
Posts: 4
Joined: Tue Jul 14, 2020 2:05 am

Mr_Noodle wrote:Are you using automatic date detection or specifying a pattern?


I've tried both and neither has worked.

Let me know if you'd like me to try anything else or if you'd like me to send you a sample PDF.

(BTW, thank you for writing this App. It's indispensable).
nedinfrance
 
Posts: 3
Joined: Wed Jan 27, 2021 12:13 pm

Re: Recognizing international date formats Mon Feb 01, 2021 11:36 am • by Mr_Noodle
Can you post the pattern you are using?
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Can you post the pattern you are using?


I'm sorry for the slow response. I'm not sure how you want it posted. Like so, with a space between each token:

"31 December 1999"
nedinfrance
 
Posts: 3
Joined: Wed Jan 27, 2021 12:13 pm

Re: Recognizing international date formats Thu Feb 04, 2021 11:38 am • by Mr_Noodle
That looks correct and if you have French in the language list it should work. Can you email in to support with an export of your rules as well as a file that demonstrates the problem?
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Recognizing international date formats Fri Feb 05, 2021 4:57 am • by mkalina
Oh, I just see that my thread seems more popular than I thought. Here is a typical example of my problem - with a Mailchimp-receipt I use. I made a screenshot, so you can see the issue: https://www.dropbox.com/s/wtn6c0jcwycp6 ... 7.jpg?dl=0

Thanks!
mkalina
 
Posts: 11
Joined: Sat Nov 16, 2013 10:48 am

Re: Recognizing international date formats Fri Feb 05, 2021 11:54 am • by Mr_Noodle
Click on the badge for your condition while doing a preview. That will show you the text of the file as it looks in Hazel. It may not look as you expect.
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Recognizing international date formats Sat Feb 06, 2021 3:23 am • by mkalina
Nah... it should be an exact match (if the dot does not count, as you once told me). See here: https://www.dropbox.com/s/3dy6s5pmdxw09 ... 2.jpg?dl=0.
mkalina
 
Posts: 11
Joined: Sat Nov 16, 2013 10:48 am

Re: Recognizing international date formats Mon Feb 08, 2021 11:08 am • by Mr_Noodle
Can you email in your rules as well as a file demonstrating the problem?
Mr_Noodle
Site Admin
 
Posts: 11250
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Recognizing international date formats Tue Feb 09, 2021 4:22 am • by mkalina
Sent! Thanks!
mkalina
 
Posts: 11
Joined: Sat Nov 16, 2013 10:48 am

Next

Return to Support