Normalize dates like the music played_at plugin (#156)
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
tweet.mentions = tweet.entities?.mentions.map(({username}) => username) ?? []
|
tweet.mentions = tweet.entities?.mentions.map(({username}) => username) ?? []
|
||||||
//Format text
|
//Format text
|
||||||
console.debug(`metrics/compute/${login}/plugins > tweets > formatting tweet ${tweet.id}`)
|
console.debug(`metrics/compute/${login}/plugins > tweets > formatting tweet ${tweet.id}`)
|
||||||
|
tweet.createdAt = `${imports.date(tweet.created_at, {timeStyle:"short", timeZone:data.config.timezone?.name})} on ${imports.date(tweet.created_at, {dateStyle:"short", timeZone:data.config.timezone?.name})}`
|
||||||
tweet.text = imports.htmlescape( //eslint-disable-line function-paren-newline
|
tweet.text = imports.htmlescape( //eslint-disable-line function-paren-newline
|
||||||
//Escape tags
|
//Escape tags
|
||||||
imports.htmlescape(tweet.text, {"<":true, ">":true})
|
imports.htmlescape(tweet.text, {"<":true, ">":true})
|
||||||
|
|||||||
@@ -25,10 +25,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<% if (plugins.tweets.profile) { %>
|
<% if (plugins.tweets.profile) { %>
|
||||||
<% if (plugins.tweets.list.length) { %>
|
<% if (plugins.tweets.list.length) { %>
|
||||||
<% for (const {text, created_at} of plugins.tweets.list) { %>
|
<% for (const {text, createdAt } of plugins.tweets.list) { %>
|
||||||
<div class="tweet">
|
<div class="tweet">
|
||||||
<%- text %>
|
<%- text %>
|
||||||
<div class="date"><%= new Date(created_at).toGMTString() %></div>
|
<div class="date"><%= createdAt %></div>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
|
|||||||
Reference in New Issue
Block a user