fix(feed): published data should be formatted correctly

- rename 'data' function to 'formatDate' for clarity
This commit is contained in:
MDLeom 2020-07-01 08:23:48 +01:00
parent 88a26ab144
commit c0c8c846d1
No known key found for this signature in database
GPG Key ID: 5D9DB57A25D34EE3
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@
<link href="{{ feed_url | uriencode }}" rel="self"/>
{% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %}
<link href="{{ url | uriencode }}"/>
<updated>{% if posts.first().updated %}{{ posts.first().updated | date }}{% else %}{{ posts.first().date | date }}{% endif %}</updated>
<updated>{% if posts.first().updated %}{{ posts.first().updated | formatDate }}{% else %}{{ posts.first().date | formatDate }}{% endif %}</updated>
<id>{{ url | uriencode }}</id>
{% if config.author %}
<author>
@ -20,8 +20,8 @@
<title>{{ post.title }}</title>
<link href="{{ post.permalink }}"/>
<id>{{ post.permalink }}</id>
<published>{{ post.date.toISOString() }}</published>
<updated>{% if post.updated %}{{ post.updated | date }}{% else %}{{ post.date | date }}{% endif %}</updated>
<published>{{ post.date | formatDate }}</published>
<updated>{% if post.updated %}{{ post.updated | formatDate }}{% else %}{{ post.date | formatDate }}{% endif %}</updated>
{% if config.feed.content and post.content %}
<content type="html"><![CDATA[{{ post.content | noControlChars | safe }}]]></content>
{% endif %}

View File

@ -16,7 +16,7 @@ env.addFilter('noControlChars', str => {
return str.replace(/[\x00-\x1F\x7F]/g, '') // eslint-disable-line no-control-regex
})
env.addFilter('date', str => {
env.addFilter('formatDate', str => {
return moment(str).format('YYYY-MM-DD[T00:00:00.000Z]')
})