mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Reverted "Stripped moment from BaseSiteMapGenerator"
refs https://ghost.slack.com/archives/C02G9E68C/p1729083762579479
- this reverts commit 30220aa6ef
.
This commit is contained in:
parent
1068f6ed13
commit
7fc4dfaac1
@ -1,5 +1,6 @@
|
||||
const _ = require('lodash');
|
||||
const xml = require('xml');
|
||||
const moment = require('moment');
|
||||
const path = require('path');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
const localUtils = require('./utils');
|
||||
@ -95,24 +96,23 @@ class BaseSiteMapGenerator {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Date}
|
||||
* @returns {moment.Moment}
|
||||
*/
|
||||
getLastModifiedForDatum(datum) {
|
||||
if (datum.updated_at || datum.published_at || datum.created_at) {
|
||||
const modifiedDate = datum.updated_at || datum.published_at || datum.created_at;
|
||||
|
||||
return new Date(modifiedDate);
|
||||
return moment(modifiedDate);
|
||||
} else {
|
||||
return new Date();
|
||||
return moment();
|
||||
}
|
||||
}
|
||||
|
||||
updateLastModified(datum) {
|
||||
const lastModified = this.getLastModifiedForDatum(datum);
|
||||
const lastModifiedTime = lastModified.getTime();
|
||||
|
||||
if (lastModifiedTime > this.lastModified) {
|
||||
this.lastModified = lastModifiedTime;
|
||||
if (lastModified > this.lastModified) {
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user