Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I modify my Ghost.org blog's date format

My Ghost.org blog displays dates as:

04 Nov 2013

This is controlled in content\themes\{theme-name}\post.hbs via:

<time datetime="{{date format="YYYY-MM-DD"}}">
    {{date format='DD MMM YYYY'}}
</time> 

I want this changed to a different format, like Wednesday, 4th November 2013, how can I do this?

like image 703
James Donnelly Avatar asked Jan 12 '23 23:01

James Donnelly


1 Answers

Ghost uses Moment.js to output dates.

From their display format documentation we can determine that:

  • dddd can be used to output the full day name;
  • MMMM can be used to output the full month name;
  • Do can be used to output the date in 1st 2nd 3rd 4th... format;
  • YYYY can be used to output the full year number.

From this we can craft our desired date format in content\themes\{theme-name}\post.hbs using:

<time datetime="{{date format="YYYY-MM-DD"}}">
    {{date format='dddd, MMMM Do YYYY'}}
</time>

Wednesday, 4th November 2013

like image 75
James Donnelly Avatar answered Jan 16 '23 18:01

James Donnelly