diff --git a/gulpfile.babel.js b/gulpfile.babel.js index cd41715..357cfb5 100755 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -14,6 +14,7 @@ import jsonTransform from 'gulp-json-transform'; import mkdirp from 'mkdirp'; import mergeStream from 'merge-stream'; import path from 'path'; +import php from 'phpjs'; import prettyData from 'gulp-pretty-data'; import rename from 'gulp-rename'; import runSequence from 'run-sequence'; @@ -290,13 +291,6 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL) sortedWords[word] = words[word]; } - let monthNames = [ - "January", "February", "March", - "April", "May", "June", "July", - "August", "September", "October", - "November", "December" - ]; - for (const row of spreadsheet) { let currentSlug = slugify(row.word); let currentWord = words[currentSlug]; @@ -336,8 +330,8 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL) currentWord.wordid = currentWord.wordid.substring(4,currentWord.wordid.length); } - let date = new Date(currentWord.submissiondate); - currentWord.formatteddate = monthNames[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear(); + currentWord.formatteddate = php.date('F j, Y', php.strtotime(currentWord.submissiondate)); + currentWord.pubdate = php.date('r', php.strtotime(currentWord.submissiondate)); const tweetTextString = `“${currentWord.word}”: Corporate language crime no. ${currentWord.wordid} https://ig.ft.com/sites/guffipedia/${currentSlug}`; const tweetTextRSSTemplate = Handlebars.compile('{{tweetText}}'); @@ -428,6 +422,7 @@ gulp.task('create-rss-feed', () => { rssString += `${currentWord.tweettextrss}`; rssString += `${rssLink}${slug}/`; rssString += `${rssLink}${slug}/`; + rssString += `${currentWord.pubdate}/`; rssString += `${currentWord.formatteddate}`; rssString += `${currentWord.slug}`; rssString += `${currentWord.wordid}`; diff --git a/package.json b/package.json index afed82c..dcdfe60 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "mkdirp": "^0.5.1", "node-fetch": "^1.3.3", "nodemon": "^1.8.1", + "phpjs": "^1.3.2", "run-sequence": "^1.1.4", "subdir": "0.0.3", "vinyl-buffer": "^1.0.0",