How to get date with st nd or th using formatdate

Here a custom formatter that uses moment.js for formatting the date.

Place following script in a js file or script block:

dmx.Formatter('string', 'formatDate2', function(val, format) {
  return moment(val).format(format);
});

Now use it like:

{{ next_birthday.formatDate2("dddd, MMMM Do YYYY") }}
6 Likes