Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Fixed date formats in API
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasmh committed May 23, 2017
1 parent 9e73329 commit f0aa824
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ fs.readdirSync('./posts').forEach(file => {
articles.push({
authors: post.attributes.author.split(/\s*[,&]\s*/),
content: content,
date: post.attributes.date,
date: post.attributes.date.toISOString(),
description: post.body.split(/\n/)[0],
link: slugify(file),
title: post.attributes.title
Expand Down Expand Up @@ -518,8 +518,8 @@ function createAmpArticle (data) {
"@type": "Person",
"name": "${data.attributes.author || 'Ascend NTNU'}"
},
"dateCreated": "${data.attributes.date}",
"datePublished": "${data.attributes.date}",
"dateCreated": "${data.attributes.date.toISOString()}",
"datePublished": "${data.attributes.date.toISOString()}",
"genre": "technology",
"headline": "${data.attributes.title}",
"image": [
Expand Down Expand Up @@ -583,7 +583,7 @@ function createFBInstantArticle (data) {
data.desc = data.desc || `Autonomus aerial robotics. Ascend NTNU is The Norwegian University of Science and Technology's team in the International Aerial Robotics Competition (IARC).`
data.image = data.image || '/images/logo/logo.png'
data.link = data.link || ''
let date = new Date(data.attributes.date)
var date = data.attributes.date.toISOString()
var parsed = reader.parse(data.body)
var result = writer.render(parsed)

Expand All @@ -605,8 +605,8 @@ function createFBInstantArticle (data) {
"@type": "Person",
"name": "${data.attributes.author || 'Ascend NTNU'}"
},
"dateCreated": "${data.attributes.date}",
"datePublished": "${data.attributes.date}",
"dateCreated": "${date}",
"datePublished": "${date}",
"genre": "technology",
"headline": "${data.attributes.title}",
"image": [
Expand Down Expand Up @@ -652,7 +652,7 @@ function createRSSFeed (articles) {
</content:encoded>
<guid>${item.link}</guid>
<description>${item.description}</description>
<pubDate>${item.date}</pubDate>
<pubDate>${new Date(item.date).toISOString()}</pubDate>
${authors.join('\n ')}
</item>`
})
Expand All @@ -677,7 +677,7 @@ function createSitemap (articles) {
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url><priority>1.00</priority><loc>https://ascendntnu.no/</loc><changefreq>weekly</changefreq><lastmod>2017-05-08T23:00:00+00:00</lastmod></url>
<url><priority>1.00</priority><loc>https://ascendntnu.no/</loc><changefreq>weekly</changefreq><lastmod>${new Date().toISOString()}</lastmod></url>
<url><priority>0.90</priority><loc>https://ascendntnu.no/about</loc><changefreq>weekly</changefreq></url>
<url><priority>0.90</priority><loc>https://ascendntnu.no/join</loc><changefreq>weekly</changefreq></url>
<url><priority>0.90</priority><loc>https://ascendntnu.no/team</loc><changefreq>monthly</changefreq></url>
Expand Down

0 comments on commit f0aa824

Please sign in to comment.