Skip to content

Commit

Permalink
Reverted "Stripped moment from BaseSiteMapGenerator"
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellockyer authored and tilak999 committed Nov 20, 2024
1 parent 752937a commit ca76ed2
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit ca76ed2

Please sign in to comment.