February 25th, 2008


mac annoyance #0xf3d54 // tech

so ja, playing around with Mail.app (the default (and normally quite useful) mail program on OSX) I came across a slight bug.

Well, okay, perhaps it's not a *bug* per-se, but a lack of consistency which leads to dissimilar results from functions with similar names. So it's kind-of a bug.

In Mail, you are allowed to create what they call "smart mailboxes". These are mailboxes which don't actually store any mail of their own, but they will search across all your other mailboxes and display the results of that search (which can be reasonably complex -- no full-message regex searching, but most standard search queries could be managed). One of the categories that you can search on is "date received" and it has a qualifier of "is exactly X Y ago", where X is a number and Y is one of "days", "weeks", "months", or "years". So you can search on messages that came in exactly 4 days ago, or exactly 55 years ago.

Not rocket science, sure. Particularly easy when you remember that OSX has Spotlight built-in at a very low level and everything you do gets included in the database. It's actually quite easy to plug this kind of functionality into the mail program (or any other program, for that matter).

So yeah, anyway, the issue I have is with the "exactly" keyword. I search for mail that was received exactly 3652 days (10 years, including leap days (at the moment, next week it'll likely be 3653)) ago and it nicely returns the 4 email messages I've managed to hold on to from 25.Feb.1998 (today in history: one of my friends wrote me (actually, he sent it to all his friends) an email to announce he had purchased a light blue 1986 Accord). But, if I change the folder to be "exactly 10 years ago" it suddenly decides that mail received on 31.Dec.1998 was just as "exactly" 10 years ago as mail received on 1.Jan.1998. Nice enough if I want to re-live the year 1998, but not so much of the "exactly" qualifier. Clearly when you select anything other than the "days" qualifier, it switches from "received exactly X ago" to "that was received anytime during the week/month/year that is X ago". There is no visual cue this change will take place, though. It still says "exactly" even though it is nothing even close to that.

Now I can hear you say, "Lograh, why would you ever want to have a search folder for so long ago?" or "So, fine, use '3652 days' instead of '10 years', what's the big deal?" Here's the big deal: I was trying to build a "today in history" folder, which would include any mail that was received either 1 year ago, 2 years ago, 3 years ago, . . . up to 25 years ago (even though the oldest email I have is from 1997 I didn't want to have to change this folder's definition every year. :) ). I can't just do 365 days ago, and 730 days ago, and so forth since the leap days will muck up with those calculations with each passing year. If I could just say it in 'years ago' then the computer (which has handy formulas for figuring out how many days were in a given year) could make the appropriate adjustments as leap days come between me and the target emails.

* note: I am aware that something sent at 14:35 on 25.Feb.1998 (when the car announcement came in) is also not "exactly" 10 years ago (as it is now 16:20), but you seriously must draw the line somewhere and with mail searching the level of granularity is generally at the calendar-day level.