Use timezone in metadata (#307)

This commit is contained in:
Simon Lecoq
2021-05-17 19:16:13 +02:00
committed by GitHub
parent aabb21fbd7
commit c694dcc3a1
4 changed files with 8 additions and 4 deletions

View File

@@ -102,7 +102,11 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q
} }
//Meta //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 //Debug flags
if (dflags.includes("--cakeday")) { if (dflags.includes("--cakeday")) {

View File

@@ -14,7 +14,7 @@
<% if (account === "user") { %> <% if (account === "user") { %>
<span>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 %><% } %></span> <span>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 %><% } %></span>
<% } %> <% } %>
<span>Last updated <%= new Date().toGMTString() %> with lowlighter/metrics@<%= meta.version %></span> <span>Last updated <%= meta.generated %> with lowlighter/metrics@<%= meta.version %></span>
</footer> </footer>
<% } %> <% } %>
<div id="metrics-end"></div> <div id="metrics-end"></div>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -26,7 +26,7 @@
<% if (base.metadata) { %> <% if (base.metadata) { %>
<footer> <footer>
<span>Last updated <%= new Date().toGMTString() %> with lowlighter/metrics@<%= meta.version %></span> <span>Last updated <%= meta.generated %> with lowlighter/metrics@<%= meta.version %></span>
</footer> </footer>
<% } %> <% } %>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -48,7 +48,7 @@ Metrics generator <%= meta.version %>
These generated metrics comes with ABSOLUTELY NO These generated metrics comes with ABSOLUTELY NO
WARRANTY, to the extent permitted by applicable law. WARRANTY, to the extent permitted by applicable law.
Last generated: <%= new Date().toGMTString() %> Last generated: <%= meta.generated %>
</div><% } -%> </div><% } -%>
<% for (const partial of [...partials]) { %><%- await include(`partials/${partial}.ejs`) %><% } -%> <% for (const partial of [...partials]) { %><%- await include(`partials/${partial}.ejs`) %><% } -%>
<% if (base.metadata) { -%> <% if (base.metadata) { -%>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB