in webui/js/ponymail.js [1384:1431]
function datePickerValue(seedPeriod) {
// This is for recalcing the set options if spawned from a
// select/input box with an existing value derived from an
// earlier call to datePicker
let rv = seedPeriod
if (seedPeriod && seedPeriod.search && seedPeriod.search(/=|-/) != -1) {
// Less than N units ago?
if (seedPeriod.match(/lte/)) {
let m = seedPeriod.match(/lte=(\d+)([dMyw])/)
let unitt = DATE_UNITS[m[2]]
if (parseInt(m[1]) != 1) {
unitt += "s"
}
rv = "Less than " + m[1] + " " + unitt + " ago"
}
// More than N units ago?
if (seedPeriod.match(/gte/)) {
let m = seedPeriod.match(/gte=(\d+)([dMyw])/)
let unitt = DATE_UNITS[m[2]]
if (parseInt(m[1]) != 1) {
unitt += "s"
}
rv = "More than " + m[1] + " " + unitt + " ago"
}
// Date range?
if (seedPeriod.match(/dfr/)) {
let mf = seedPeriod.match(/dfr=(\d+-\d+-\d+)/)
let mt = seedPeriod.match(/dto=(\d+-\d+-\d+)/)
if (mf && mt) {
rv = "From " + mf[1] + " to " + mt[1]
}
}
// Month??
if (seedPeriod.match(/^(\d+)-(\d+)$/)) {
let mr = seedPeriod.match(/(\d+)-(\d+)/)
if (mr) {
let dfrom = new Date(parseInt(mr[1]), parseInt(mr[2]) - 1, 1, 0, 0, 0)
rv = MONTHS[dfrom.getMonth()] + ', ' + mr[1]
}
}
}
return rv
}