mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-16 12:16:09 +03:00
14 lines
361 B
JavaScript
14 lines
361 B
JavaScript
|
function getPublishedDate(data) {
|
||
|
var context = data.context ? data.context[0] : null,
|
||
|
pubDate;
|
||
|
if (data[context]) {
|
||
|
pubDate = data[context].published_at || data[context].created_at || null;
|
||
|
if (pubDate) {
|
||
|
return new Date(pubDate).toISOString();
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
module.exports = getPublishedDate;
|