diff --git a/ghost/admin/app/components/posts-list/list-item-clicks.hbs b/ghost/admin/app/components/posts-list/list-item-clicks.hbs index 4f43daf45c..239e39a095 100644 --- a/ghost/admin/app/components/posts-list/list-item-clicks.hbs +++ b/ghost/admin/app/components/posts-list/list-item-clicks.hbs @@ -24,7 +24,7 @@ {{#if this.isHovered}} - {{gh-format-post-time @post.updatedAtUTC "D MMM YYYY"}} + {{gh-format-post-time @post.updatedAtUTC format="D MMM YYYY"}} {{else}} {{gh-format-post-time @post.updatedAtUTC draft=true}} {{/if}} @@ -65,7 +65,7 @@ {{gh-format-post-time @post.updatedAtUTC draft=true}} {{#if this.isDateHovered}} - on {{gh-format-post-time @post.updatedAtUTC "D MMM YYYY"}} + on {{gh-format-post-time @post.updatedAtUTC format="D MMM YYYY"}} {{/if}} {{!-- {{#if @post.lexical}} diff --git a/ghost/admin/app/components/posts-list/list-item.hbs b/ghost/admin/app/components/posts-list/list-item.hbs index c4dc137faa..dcbe4fcb5c 100644 --- a/ghost/admin/app/components/posts-list/list-item.hbs +++ b/ghost/admin/app/components/posts-list/list-item.hbs @@ -20,7 +20,7 @@ in {{@post.primaryTag.name}} {{/if}} - • {{gh-format-post-time @post.updatedAtUTC draft=true}} + • {{gh-format-post-time @post.updatedAtUTC draft=true}}

@@ -43,7 +43,7 @@ in {{@post.primaryTag.name}} {{/if}} - • {{gh-format-post-time @post.updatedAtUTC draft=true}} + • {{gh-format-post-time @post.updatedAtUTC draft=true}}

diff --git a/ghost/admin/app/helpers/gh-format-post-time.js b/ghost/admin/app/helpers/gh-format-post-time.js index b627111ccd..99cbb2d8a7 100644 --- a/ghost/admin/app/helpers/gh-format-post-time.js +++ b/ghost/admin/app/helpers/gh-format-post-time.js @@ -3,13 +3,18 @@ import moment from 'moment'; import {assert} from '@ember/debug'; import {inject as service} from '@ember/service'; -export function formatPostTime(timeago, {timezone = 'etc/UTC', draft, scheduled, published}) { +export function formatPostTime(timeago, {timezone = 'etc/UTC', format, draft, scheduled, published}) { if (draft) { // No special handling for drafts, just use moment.from return moment(timeago).from(moment.utc()); } let time = moment.tz(timeago, timezone); + + if (format) { + return time.format(format); + } + let now = moment.tz(moment.utc(), timezone); let utcOffset; @@ -44,8 +49,8 @@ export function formatPostTime(timeago, {timezone = 'etc/UTC', draft, scheduled, } // Else, render just the date if published, or the time & date if scheduled - let format = scheduled ? `[at] HH:mm [${utcOffset}] [on] DD MMM YYYY` : 'DD MMM YYYY'; - return time.format(format); + let f = scheduled ? `[at] HH:mm [${utcOffset}] [on] DD MMM YYYY` : 'DD MMM YYYY'; + return time.format(f); } export default class GhFormatPostTimeHelper extends Helper {