0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added exact timestamp to the title attribute of the post date in the … (#19936)

…post list view

Ref DES-171
This commit is contained in:
Sanne de Vries 2024-03-27 13:52:38 +01:00 committed by GitHub
parent a1afc87757
commit f8a55de743
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -55,7 +55,7 @@ export function formatPostTime(timeago, {timezone = 'etc/UTC', format, relative,
}
// Else, render just the date if edited or published, or the time & date if scheduled
let f = scheduled ? `[at] HH:mm [${utcOffset}] [on] DD MMM YYYY` : 'DD MMM YYYY';
let f = scheduled ? `[at] HH:mm [${utcOffset}] [on] DD MMM YYYY` : (short ? `DD MMM YYYY` : `HH:mm [${utcOffset}] DD MMM YYYY`);
return time.format(f);
}

View file

@ -127,6 +127,17 @@ describe('Integration: Helper: gh-format-post-time', function () {
this.set('mockDate', mockDate);
await render(hbs`{{gh-format-post-time mockDate absolute=true}}`);
expect(this.element).to.have.trimmed.text('16:00 (UTC) 02 Sep 2017');
});
it('returns correct short format if post was published prior to yesterday', async function () {
let {mockDate} = setupMockDate({
date: '2017-09-02T16:00:00Z',
utcDate: '2017-09-06T18:00:00Z'
});
this.set('mockDate', mockDate);
await render(hbs`{{gh-format-post-time mockDate absolute=true short=true}}`);
expect(this.element).to.have.trimmed.text('02 Sep 2017');
});