Kibana Canvas - Markdown date format

Is there a way to use the markdown content to write the previous month?

Just now, I use {date | formatdate "MMMM YYYY"} which produces November 2020 however I'm wondering if there's a way to write the last months date. e.g. October 2020.


Good morning, Kev!

This is tough one. Unfortunately, I don't think you're going to be able to do this with date or formatdate alone, because date math is tough to begin with. We don't (currently) expose date manipulation functionality, (though I suppose we could at some point).

One solution would be to subtract 30 days from epoch (but isn't 100% accurate, as months vary in length):

date | math "subtract(value, 2592000000)" | formatdate format="MMMM YYYY"

You can always file an enhancement request for us to expose momentjs date manipulation as a function, or write one yourself and include it as a plugin in Canvas. Otherwise, I'm afraid you're left with trying to perform the date math as part of your query, or other approach.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.