Use moment.js for date formatting

This commit is contained in:
Pat O'Brien 2019-10-03 10:24:29 -04:00
parent d2183dce4f
commit f82d50b56e
5 changed files with 11 additions and 3 deletions

View file

@ -10,4 +10,7 @@ DOMAINS=yourdomain,sub.yourdomain
[MAILSERVER]
; Port that the Mailserver will run on (default 25 but that needs root)
MAILPORT=25
MAILPORT=25
[DATETIME]
; The moment.js format you'd like your date to be formatted in
DATEFORMAT="D.M.YYYY HH:mm"

View file

@ -60,6 +60,7 @@ switch($action)
{
$o['status'] = 'ok';
$o['type'] = 'admin';
$o['dateformat'] = $settings['DATEFORMAT'];
$emails = listEmailAdresses();
$emaillist = array();

View file

@ -42,5 +42,6 @@
<script src="js/namegenerator.js"></script>
<script src="js/opentrashmail.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script src="js/moment-with-locales.min.js"></script>
</body>
</html>

1
web/js/moment-with-locales.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -106,8 +106,10 @@ function updateEmailTable()
}
else dateofemail = em;
if(em>lastid) lastid = em;
var date = new Date(parseInt(dateofemail))
var datestring = date.getDate()+"."+date.getMonth()+"."+date.getFullYear()+" "+date.getHours()+":"+date.getMinutes();
//var date = new Date(parseInt(dateofemail))
//var datestring = date.getDate()+"."+date.getMonth()+"."+date.getFullYear()+" "+date.getHours()+":"+date.getMinutes();
var datestring = moment.unix(parseInt(dateofemail/1000)).format(data.dateformat); // Use moment.js formatting
var ed = data.emails[em]
$("#emailtable").append('\
<tr class="anemail" onClick="loadMail(\''+email+'\','+dateofemail+');">\