From dd29f304fc50942f7d09e851c719277feb81c730 Mon Sep 17 00:00:00 2001 From: Milo <50248166+Milo123459@users.noreply.github.com> Date: Sat, 27 Feb 2021 13:39:22 +0000 Subject: [PATCH] Normalize dates like the music played_at plugin (#156) --- source/plugins/tweets/index.mjs | 1 + source/templates/classic/partials/tweets.ejs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/plugins/tweets/index.mjs b/source/plugins/tweets/index.mjs index 0173304c..3e53a1c7 100644 --- a/source/plugins/tweets/index.mjs +++ b/source/plugins/tweets/index.mjs @@ -35,6 +35,7 @@ tweet.mentions = tweet.entities?.mentions.map(({username}) => username) ?? [] //Format text 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 //Escape tags imports.htmlescape(tweet.text, {"<":true, ">":true}) diff --git a/source/templates/classic/partials/tweets.ejs b/source/templates/classic/partials/tweets.ejs index 988ecd7a..238e6189 100644 --- a/source/templates/classic/partials/tweets.ejs +++ b/source/templates/classic/partials/tweets.ejs @@ -25,10 +25,10 @@ <% if (plugins.tweets.profile) { %> <% if (plugins.tweets.list.length) { %> - <% for (const {text, created_at} of plugins.tweets.list) { %> + <% for (const {text, createdAt } of plugins.tweets.list) { %>