localize timestamps
This commit is contained in:
@@ -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='') -%}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user