warn about invalid dates such as date:yesterday
Describe the bug
mu find date:yesterday prints messages from Jan 1970
I mean, I know that I can run mu find date:2d , it is just that this behaviour is super unexpected.
To Reproduce Detailed steps to reproduce the behavior. If this is about a specific (kind of) message, always attach an (anonymized as need) example message.
mu find date:yesterday
Environment Please describe the versions of OS, Emacs, mu etc. you are using.
Emacs 27.2, mu4e 1.6.3
Checklist
- [ ] you are running either the latest 1.4.x release, or a 1.5.11+ development release (otherwise, please upgrade).
No, I am running 1.6.3
Yes, something isn't right. I get a similar result. All the messages returned have a date of Jan 01 1970 and for me, a time of 10:00. Given I'm in a +10 TZ, this looks very much like an uninitialised date value. Also the messages are not from yesterday (nor are they from 1970!).
However, if I do mu find date:2021-08-18 (yesterday's date), the data returned does have the correct date and does look like they are messages from yesterday.
Garbage in garbage out... yesterday is not a supported date value.
(mu tries to make the best of the date description, and sees the 'y', mu find date:yabadabadoo gives the same result). Perhaps a better error would be useful, so keeping this as an RFE.
I should have verified that yesterday was a legitimate selector. I knew today and now were, but just assumed - which made an ass out of u and me (well just me really!).
I guess it would be better if an error is thrown when an unrecognised 'term' is used for date operations which are not understood rather than just returning garbage. I can imagine a more complex query with a simple typo that returns data and it isn't obvious something went wrong.
mu/mu4e try not to warn about "incorrect" queries, in the same way that Google doesn't give you syntax errors for searches. It's hard to come up with a nice UX for that.
However, all is not lost -- mu find now has the --analyze option which shows how mu interprets your query, so if your query does not get the expected results, it's recommend to use that.