From 7fc4dfaac1cea366d6119619eca93047ee9114b5 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 16 Oct 2024 15:15:13 +0200 Subject: [PATCH] Reverted "Stripped moment from BaseSiteMapGenerator" refs https://ghost.slack.com/archives/C02G9E68C/p1729083762579479 - this reverts commit 30220aa6effd043c0b120a975e6e484adb86c118. --- .../services/sitemap/BaseSiteMapGenerator.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ghost/core/core/frontend/services/sitemap/BaseSiteMapGenerator.js b/ghost/core/core/frontend/services/sitemap/BaseSiteMapGenerator.js index cfbd119dd9..3f60c69f18 100644 --- a/ghost/core/core/frontend/services/sitemap/BaseSiteMapGenerator.js +++ b/ghost/core/core/frontend/services/sitemap/BaseSiteMapGenerator.js @@ -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; } }