From c694dcc3a154eb59a138894e3fc2828f0929f759 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Mon, 17 May 2021 19:16:13 +0200 Subject: [PATCH] Use timezone in metadata (#307) --- source/plugins/core/index.mjs | 6 +++++- source/templates/classic/image.svg | 2 +- source/templates/repository/image.svg | 2 +- source/templates/terminal/image.svg | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/plugins/core/index.mjs b/source/plugins/core/index.mjs index 794634f3..71bf2c98 100644 --- a/source/plugins/core/index.mjs +++ b/source/plugins/core/index.mjs @@ -102,7 +102,11 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q } //Meta - data.meta = {version:conf.package.version, author:conf.package.author} + data.meta = { + version:conf.package.version, + author:conf.package.author, + generated:new Date(new Date().getTime() + (data.config.timezone?.offset ?? 0)).toGMTString().replace(/GMT$/g, "").trim() + } //Debug flags if (dflags.includes("--cakeday")) { diff --git a/source/templates/classic/image.svg b/source/templates/classic/image.svg index 5aff309e..aee792fe 100644 --- a/source/templates/classic/image.svg +++ b/source/templates/classic/image.svg @@ -14,7 +14,7 @@ <% if (account === "user") { %> These metrics <%= !computed.token.scopes.includes("repo") ? "do not include all" : "include" %> private contributions<% if ((config.timezone?.name)&&(!config.timezone?.error)) { %>, timezone <%= config.timezone.name %><% } %> <% } %> - Last updated <%= new Date().toGMTString() %> with lowlighter/metrics@<%= meta.version %> + Last updated <%= meta.generated %> with lowlighter/metrics@<%= meta.version %> <% } %>
diff --git a/source/templates/repository/image.svg b/source/templates/repository/image.svg index 29b9debb..c2dcb17c 100644 --- a/source/templates/repository/image.svg +++ b/source/templates/repository/image.svg @@ -26,7 +26,7 @@ <% if (base.metadata) { %> <% } %> diff --git a/source/templates/terminal/image.svg b/source/templates/terminal/image.svg index 10fafed1..2e46eb1e 100644 --- a/source/templates/terminal/image.svg +++ b/source/templates/terminal/image.svg @@ -48,7 +48,7 @@ Metrics generator <%= meta.version %> These generated metrics comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. -Last generated: <%= new Date().toGMTString() %> +Last generated: <%= meta.generated %> <% } -%> <% for (const partial of [...partials]) { %><%- await include(`partials/${partial}.ejs`) %><% } -%> <% if (base.metadata) { -%>