apache / incubator-ponymail

Apache Pony Mail (Incubating) - Email for Ponies & People
http://ponymail.incubator.apache.org/
Other
80 stars 30 forks source link

Enh: simplify date range calculations spanning a month #279

Open sebbASF opened 7 years ago

sebbASF commented 7 years ago

The date range calculations currently work out the end of the month. This involves leap-year calculations and a table of days in each month.

It would be simpler to express the date range as gte=YYYY/MM/01 00:00:00 lt=YYYY'/MM'/01 00:00:00 where MM' is MM+1 unless MM=12 etc.

Also, rather than using the string date field, it would likely be more efficient to use the epoch.

sebbASF commented 7 years ago

This affects mbox.lua and stats.lua which both have copies of the code

sebbASF commented 7 years ago

Using the epoch would be tricky for relative dates such as "less than 2 months ago" which are currently handled by the ES database.