Skip to content

Commit 7340ae3

Browse files
committed
add relative timestamps
1 parent 3e4bdb9 commit 7340ae3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

python-build/build_site.py

+14
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ def package_name(wheel_file: pathlib.Path) -> str:
5959
6060
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css" integrity="sha256-cDGQ39yChhpN5vzgHbjIdGEtQ5kXE9tttCsI7VR9TuY=" crossorigin="anonymous">
6161
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.js" integrity="sha256-fN8vcX2ULyTDspVTHEteK8hd3rQAb5thNiwakjAW75Q=" crossorigin="anonymous"></script>
62+
63+
<!-- CDN example (jsDelivr) -->
64+
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
65+
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/utc.js"></script>
66+
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.js"></script>
67+
<script>dayjs.extend(window.dayjs_plugin_utc)</script>
68+
<script>dayjs.extend(window.dayjs_plugin_relativeTime)</script>
6269
</head>
6370
<body>
6471
<div class="ui container">
@@ -68,6 +75,9 @@ def package_name(wheel_file: pathlib.Path) -> str:
6875
</p>
6976
7077
<h2>Build context</h2>
78+
<p>
79+
Built <span id="build-timestamp">at {ts}</span>.
80+
</p>
7181
<pre id="context-info">{json.dumps(context_info, indent=2)}</pre>
7282
7383
<h2>Usage</h2>
@@ -105,6 +115,10 @@ def package_name(wheel_file: pathlib.Path) -> str:
105115
document.querySelectorAll(".base-url").forEach(el => {{
106116
el.textContent = baseUrl;
107117
}});
118+
119+
const buildTimestamp = document.getElementById("build-timestamp");
120+
const buildTimestampDate = dayjs('{ts}');
121+
buildTimestamp.textContent = buildTimestampDate.fromNow();
108122
</script>
109123
</html>
110124
"""

0 commit comments

Comments
 (0)