Adam A
Adam A

Reputation: 14618

Why doesn't Slack format my <!date> message?

I'm trying to format a date in a Slack message via the Web API. I'm using Botkit and thus my fields are being parsed with Mustache, however logs show that the correct formatting is coming out afterwards (therefore I don't think Mustache is the issue here).

The message as shown in Botkit debug logs is "... on <!date^1511407982054^{date_long_pretty} at {time}|Wednesday at 10am> ...". Other <formatting> in the message works just fine both before and after this occurrence.

I'm sure I'm at fault, but can't figure out how. Any help would be appreciated.

Slack rendering:

screenshot in Slack

Some things I've tried:

Upvotes: 1

Views: 2898

Answers (1)

Adam A
Adam A

Reputation: 14618

Turns out I needed to use Math.floor(new Date().getTime() / 1000) to generate the Unix timestamp

Upvotes: 3

Related Questions