Closed romanofski closed 7 years ago
what type do you want?
Can it be a UTCTime?
notmuch API provides time_t notmuch_message_get_date(notmuch_message_t *message);
.
This avoids parsing the message but is a loss of information w.r.t. the mail itself (the Date
header
usually contains a TZ offset).
Nevertheless the UTCTime is appropriate for sorting and other basic operations we might want to do without parsing the message.
So I think we want both: a function Message -> IO UTCTime
, and a function
ParsedMessage -> ZonedTime
.
I'm still weighing up whether to go with the time library or something else (e.g. thyme).
Oh right, but this an hs-notmuch ticket so we just need Message -> IO UTCTime 👍
I'm still a bit conflicted about exposing date as a UTCTime
given that this is a loss of
information from what is in the headers, i.e. we really want to encourage lib users to
handle the date header parsed from the message itself, instead.
Anyhow, here it is.
Thinking about it more, I realise the problem you're describing. Thinking back to my typical use case (can't use anything else atm), the index in mutt only shows a rough date (e.g. 28/Jun) while the specific date is displayed when you view the mail.
Keeping that in mind, perhaps there is no real case for the specific time to be displayed. I don't know if it could lead to problems when querying tho. I guess we'll see and change it if need arises?
On Thu, Jul 27, 2017 at 02:55:39AM +0000, Roman Joost wrote:
I guess we'll see and change it if need arises?
Yep.
In order to display something meaningful, hs-notmuch should parse date headers as date types.