Merge pull request #8 from poblabs/momentjs

Use moment.js for date formatting
This commit is contained in:
Christian Haschek 2019-10-06 18:58:09 +02:00 committed by GitHub
commit f93063b4da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 5 deletions

View file

@ -25,17 +25,27 @@ echo ' [+] Setting up config.ini'
echo "[GENERAL]" > /var/www/opentrashmail/config.ini
if [ "$DOMAINS" != "" ]; then
echo "DOMAINS=$DOMAINS" >> /var/www/opentrashmail/config.ini
echo " [i] Active Domain(s): $DOMAINS"
echo " [i] Active Domain(s): $DOMAINS"
fi
if [ "$ADMIN" != "" ]; then
echo "ADMIN=$ADMIN" >> /var/www/opentrashmail/config.ini
echo " [i] Set admin to: $ADMIN"
echo " [i] Set admin to: $ADMIN"
fi
echo "[MAILSERVER]" >> /var/www/opentrashmail/config.ini
echo "MAILPORT=25" >> /var/www/opentrashmail/config.ini
echo "[DATETIME]" >> /var/www/opentrashmail/config.ini
if [ "$DATEFORMAT" != "" ]; then
echo "DATEFORMAT=$DATEFORMAT" >> /var/www/opentrashmail/config.ini
echo " [i] Setting up dateformat to: $DATEFORMAT"
else
echo "DATEFORMAT='D.M.YYYY HH:mm'" >> /var/www/opentrashmail/config.ini
echo " [i] Using default dateformat"
fi
cd /var/www/opentrashmail/python
echo ' [+] Starting Mailserver'

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

@ -111,8 +111,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+');">\