Specifying Year for Matches on Feb 29

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

Moderator: Mr_Noodle

Specifying Year for Matches on Feb 29 Thu Jan 16, 2014 7:18 pm • by nlucchesi
I have a script that matches dates contained in a PDF; I works perfectly except on Feb 29 in 2008, where it returns Mar 1, 2008.

I match on month and day so it's picking up Feb 29 correctly. But, when I try to use the match, I have no way to specify that the date's year is a leap year. So, the date is incremented one day to Mar 1. (This auto day increment feature was apparently introduced in Version 3.2.2 (Nov 20, 2013) based on reading the release notes: http://www.noodlesoft.com/release_notes.php)

So, how do I get Feb 29 to output as Feb 29 instead of Mar 1? How do I set the year portion of the match variable to a leap year?

Thank you for listening.

- nello
nlucchesi
 
Posts: 35
Joined: Thu Jan 16, 2014 1:33 pm

Re: Specifying Year for Matches on Feb 29 Thu Jan 16, 2014 7:22 pm • by nlucchesi
In case you are wondering, I don't see how to use the month day AND YEAR in my match. Unfortunately, the year characters for 2008 are "200" followed by a unicode character (that this board won't let me post) so the year doesn't match.
nlucchesi
 
Posts: 35
Joined: Thu Jan 16, 2014 1:33 pm

Re: Specifying Year for Matches on Feb 29 Fri Jan 17, 2014 4:27 pm • by Mr_Noodle
So, the year in the document is not a valid year? I'm unclear on how it matches at all if it's some unprintable unicode character. If you are not matching the year in the pattern, then Hazel will use the current year so it's important to match the year. Is this an OCR issue perhaps?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Specifying Year for Matches on Feb 29 Fri Jan 17, 2014 5:15 pm • by nlucchesi
Mr_Noodle wrote:So, the year in the document is not a valid year? I'm unclear on how it matches at all if it's some unprintable unicode character. If you are not matching the year in the pattern, then Hazel will use the current year so it's important to match the year. Is this an OCR issue perhaps?


Thank you for your reply.

I don't know how the unicode got into the PDF; I'm using statements downloaded from my brokerage's website and it's hard to imagine that they OCRd them. The eights are bad in the years only during 2008, in the day of 12/28/99 and other such patterned ways. So, I think someone made a systemic error in creating the PDFs.

In any case ...

I'm using the following condition:

<contents> <contain match> { <stmtDateMTD>,200<unicode character>, month-to-date statement }

where <stmtDateMTD> is a Custom date pattern defined as { <December><31> }

As a result, stmtDateMTD contains only the month and day in the PDF and the year of System Date.

My action is:

<rename> with pattern {_2008-<stmtDateMTD><extension>}

So, I was looking for a way to assign a date's year to stmtDateMTD.

I can't use the "Adjust Date..." option on the month because I need to adjust it only for February (when the month-end date is being incremented to March 1 because the System Date is NOT a leap year), not the rest of the months. Alternatively, I could hard code an adjustment to the year, but adjustment has to be different depending on the year that Hazel runs.

The only kludge I can think of is to add a new rule to look for file names with March 1 and change them to February 29.

Is there any way that I can avoid the kludge of an additional rule?

Is there anyway to *assign* (not adjust) a the year in stmtDateMTD?

Thank you for reading.

- nello
nlucchesi
 
Posts: 35
Joined: Thu Jan 16, 2014 1:33 pm

Re: Specifying Year for Matches on Feb 29 Mon Jan 20, 2014 4:14 pm • by Mr_Noodle
There's no way to do that now. If you really want to fix it, I suggest looking into your OCR software as it is likely it will botch other things as well if it does this.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Specifying Year for Matches on Feb 29 Mon Jan 20, 2014 5:36 pm • by nlucchesi
Okay.

I added a March 1 rule and it all works.

Like I said, I download these statements from my brokerage company so there's nothing I can do about the way PDFs are generated.

Thank you.
nlucchesi
 
Posts: 35
Joined: Thu Jan 16, 2014 1:33 pm


Return to Support