mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 08:31:43 +03:00
af4bfb8862
- purely for cleanliness! - we use kebabcase by default - tests should be kebab-case-file_spec.js (one day we want this to be .test.js)
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;
|