email-templates: Can not use formatDate helper inside table

Actual Behaviour

Template should be rendered.

Expected Behaviour

Test email is not received. It’s hard to say what is wrong. But when I replace table with ul or just p tags it works ok.

Steps to reproduce it

  • Create email template
<html>
<body>
<table>
<tbody>
{{#each meetings}}
<tr>
    <td>{{title}}</td>
    <td>{{formatDate startAt "h:mm"}}</td>
    <td>{{formatDate endAt "h:mm"}}</td>
</tr>
{{/each}}
</tbody>
</table>
</body>
</html>
  • Set test data
{ 
    "meetings": [
        {
            "title": "meeting 7",
            "startAt": 1633023600,
            "endAt": 1633023600
        },
        {
            "title": "meeting 8",
            "startAt": 1633023600,
            "endAt": 1633023600
        },
        {
            "title": "meeting 8",
            "startAt": 1633023600,
            "endAt": 1633023600
        }            
    ]
}
  • Editor shows data in the table.
  • Send test email
  • No email received

If you replace table with list it works fine. If you delete formatDate helper it also works

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 6
  • Comments: 15

Most upvoted comments

My workaround for that is that I use a div with display set to table-cell: <tr><td>Some Data</td><div style="display:table-cell"> {{ formatDate this.timestamp "YYYY-MM-DD" }} </div></tr>

It’s not displaying correctly in the editor but the rendered email looks good.

@MarianaKWork Yes we had this inside of a parent table and it worked for the Browser-based Email Clients, but not for Desktop Clients like Apple Mail (the table view was broken/not formatted correctly). Therefore we ended up not using the formatDate function at all and instead doing the date conversion in the backend, and sending it with the payload.

Hello, this bug still repros in March of 2023. If we could at least get some kind of indication that this is what’s happening in the error message or in the documentation, it would be really helpful. I only found this issue after multiple days of troubleshooting. It’s extremely difficult to diagnose because the template renders just fine within the editor preview, but when you attempt to send an email it fails completely, and all you get is a message that says “this message could not be sent”, which is super unhelpful.

If there is some way this issue could even just be linked in the error message it would’ve saved loads of time. Ideally, maybe it can be fixed? I don’t understand how/why this error would occur, so I have no idea how complex it would be. It was very surprising to me when I found that the preview in the editor uses a different rendering system than the actual emails when they’re sent. Are there any plans to unify them? It makes bugs 100x more confusing when you don’t even know if what you’re looking at is what will actually be in the email.

It seems like there are several relatively simple ways this issue could at least be partially addressed as opposed to just leaving this issue open indefinitely.

We have faced the same issue. The handlebar seems to break rendering when used in a loop inside a table tag . @tfuchs1 , thank you, your workaround did help. But it would be great if there is a fix for the tables to use formatDate with them as well.