Spam-Report

Dec 4, 2019
3
0
21
53
Hallo.

Ich würde gerne im Spam-Report in meinem Custom Template das Datum formatieren (dd.mm.YYYY). Derzeit ist es YYYY-mm-dd.

Wäre für eine kurze Hilfestellung dankbar.

Vielen Dank,
Marcus
 
Hi!

Zurzeit wird für die spam items das "date" field mit "strftime" und dem "%F" Format (ISO 8601 Datums Format) schon fix umgewandelt bevor es überhaupt zum Spamreport-Template kommt.

Möglicherweise kann man da selber mit dem "Date" oder "String" plugin des Template Toolkit was rum-hacken, folgendes würde für dich wahrscheinlich reichen:

Code:
item.date.split('/').reverse.join('.')

Sauberer wäre aber wenn dass auswählbar wäre, bzw. das "Roh-Datum" dem template zu verfügung steht. Oder aber die locale abhängigen "%x" und "%X" formatter verwendet würden..
 
  • Like
Reactions: MBRH
Hallo Thomas,

habe noch den Slash durch ein "-" ersetzt und es funktioniert einwandfrei. Vielen Dank!

Code:
item.date.split('-').reverse.join('.')
 
Hallo, guten Morgen,

auch wir würden gerne das Datum umformatieren (in "spamreport-custom.tt").
Wo gehört denn der o.g. Code hin?

Ich bin Webentwickler und habe von unserem Proxmox-Admin Zugriff auf die Template-Dateien unter /etc/pmg/templates erhalten.
Ich vermute aber, darin nutzt der Code nichts sondern er muss "früher" im Ablauf eingefügt werden, damit das Datum in der gewünschten Formatierung in die Templates hereingereicht werden kann!?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!