Time formatting with dt() method isn't working

Infos:

  • Used Zammad version: 6.4.1
  • Used Zammad installation type: source, self hosted
  • Operating system: Windows
  • Browser + version: Microsoft Edge on Version 132.0.2957.127

Expected behavior:

  • dt() method would change the formatting of the timestamp to the defined formatting

Actual behavior:

  • dt() method does only produce an empty value “-”, i tried it with multiple timestamp variables, none of them worked

Steps to reproduce the behavior:

I called the method using the example i found on the admin docs, which is as follows:
#{dt(ticket.created_at, "%A %Y-%m-%d %H:%M in the office", "Europe/Berlin")}

It did not work. Is the syntax wrong?

I followed every advice i found on pasting it into the textmodules, doing CTRL+Shift+V to paste as raw text, but it still didnt work

Hi @Tweiss. Could you please provide more input? Where are you trying to use it?

Hi Florian,

I was trying to use the method for a text module, to display the timestamp of the closing date as dd-mm-yyyy instead of dd-mm-yyyy hh-mm

I am aware variables do not work in templates, but in text modules it should, no?

If I’d had to bet, I’d say you’re creating the ticket at the moment you’re trying to use the text module?

If so, then that’s your problem. If the issue also exists on existing tickets, then the issue is different.

Hi @Tweiss. Could you please attach a screenshot of the configured text module? And yeah, please, answer the questions about when the text module is used. :slight_smile:

Hi, I am not trying to use the text module on ticket creation, as I am aware that this wont work, due to limitations on zamad’s side.
I’ve read the older posts about it on this forum.

I am trying to use the text module in an ongoing ticket, a screenshot of the text module in question is attached.

As earlier mentioned, I am using the in the docs provided example for the dt() method. I read the comments that you should paste the raw text, stripped of any formatting, I’ve also done that.

I can confirm that above does not work with text modules - the exact same however works. I was about to create a bug report for it but re-checked the documentation first. It clearly states: ‘… translated variable in triggers or schedulers, …’

A bummer to me to be honest and slightly unexpected. The documentation should work out this serious limitation much much better in my opinion. For date time formatting it’s even less obvious.

See: Variables — Zammad Admin Documentation documentation

Screen Recording 2025-01-31 at 12.27.07

Ah, sorry, I forgot about the related issue: Custom timestamp in auto responders (trigger based) · Issue #4911 · zammad/zammad · GitHub

It got implemented for triggers and schedulers, not for text modules.