Lumail - The console email client

Lua primitives: date_formats()

NOTE: Lumail-legacy has been superseded by Lumail 2.x, which has a wholly unified Lua API.

When in index-mode the display consists of lists of messages. These messages will be displayed according to the index_format setting.

In order to make some index_format settings available we need to parse the Date: header of the messages, and the date_formats table is used to do that.

Because date formatting varies so much the best solution is to have a lookup table of possible formats. The defaults look like this:

date_formats = {
 "%a, %d %b %y %H:%M:%S" ,
 "%a, %d %b %Y %H:%M:%S" ,
 "%d %b %y %H:%M:%S" ,
 "%d %b %Y %H:%M:%S" ,
 "%a %b %d %H:%M:%S GMT %Y" ,
 "%a %b %d %H:%M:%S MSD %Y" ,
 "%a %b %d %H:%M:%S BST %Y" ,
 "%a %b %d %H:%M:%S CEST %Y" ,
 "%a %b %d %H:%M:%S PST %Y" ,
 "%a, %d %b %y %H:%M" ,
 "%a, %d %b %Y %H:%M" ,
 "%a, %d %b %Y %H.%M.%S" ,
 "%d-%b-%Y" ,
 "%m/%d/%y" ,
 "%d %b %Y" ,
 "%a %b %d %H:%M:%S %Y" }

NOTE: The %strings refer to strptime(3) settings.


This function has been available since version 0.15.