refactor(sitemap): de-duplicate date formatting

This commit is contained in:
MDLeom 2020-07-01 08:27:26 +01:00
parent c0c8c846d1
commit 8c8dfef58a
No known key found for this signature in database
GPG Key ID: 5D9DB57A25D34EE3
2 changed files with 0 additions and 8 deletions

View File

@ -2,7 +2,6 @@
const micromatch = require('micromatch')
const template = require('./template')
const moment = require('moment')
const isMatch = (path, patterns) => {
if (patterns && patterns.length) {
@ -31,12 +30,6 @@ module.exports = function (locals) {
.sort((a, b) => {
return b.date - a.date
})
// https://github.com/pyyzcwg2833/hexo-generator-sitemap/commit/a92dbbb83cc39ff60d43faa5cd688a56574a3889
.map((post) => ({
...post,
date: moment(post.date).format('YYYY-MM-DD[T00:00:00.000Z]'),
updated: post.updated ? moment(post.updated).format('YYYY-MM-DD[T00:00:00.000Z]') : false
}))
// configuration dictionary
const xmlConfig = {

View File

@ -15,7 +15,6 @@ module.exports = function (config) {
})
env.addFilter('formatDate', str => {
if (typeof str === 'string') return str.substring(0, 10)
return moment(str).format('YYYY-MM-DD[T00:00:00.000Z]').substring(0, 10)
})