localize timestamps

This commit is contained in:
2026-05-29 05:54:51 +03:00
parent 81fa054ddf
commit af5e838232
2 changed files with 10 additions and 2 deletions

View File

@@ -5,7 +5,7 @@
{%- endmacro %}
{% macro timestamp(unix_ts) -%}
<time datetime="{{ unix_ts | iso8601 }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} <abbr title="Server Time">ST</abbr></time>
<time data-r="localizeTimestamps" datetime="{{ unix_ts | iso8601 }}">{{ unix_ts | ts_datetime('%Y-%m-%d %H:%M')}} <abbr title="Server Time">ST</abbr></time>
{%- endmacro %}
{% macro subheader(title, desc='') -%}

View File

@@ -1,6 +1,6 @@
export const b = {
babycodePreviewEndpoint: '/api/babycode-preview/',
init: 'babycodeEditorCharCountInit',
init: 'babycodeEditorCharCountInit localizeTimestamps',
}
const getThreadId = () => {
@@ -215,3 +215,11 @@ export async function copyCode(ev, sender, el) {
console.log(error);
}
}
export function localizeTimestamps(_, __, el) {
if (el === undefined) {
return;
}
const d = new Date(el.dateTime);
el.innerText = d.toLocaleString();
}