mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
c81d11b910
closes #12059 - Published Time and Modified Time were not populating for 'page' context because it is an extension of 'post' and hence there was no context 'page'. - Fixed it by using the common contextObject & `getContextObject` utility. - Should also fix some other missing parameters.
15 lines
393 B
JavaScript
15 lines
393 B
JavaScript
const getContextObject = require('./context_object.js');
|
|
|
|
function getPublishedDate(data) {
|
|
let context = data.context ? data.context[0] : null;
|
|
|
|
const contextObject = getContextObject(data, context);
|
|
|
|
if (contextObject && contextObject.published_at) {
|
|
return new Date(contextObject.published_at).toISOString();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
module.exports = getPublishedDate;
|