Display all datetimes in local time
Currently we show UTC.
We want to show the time based on the browsers locale.
The following code is a possible solution:
template.html
<time datetime="{{ .Date }}">
{{ .Date }}
</time>
index.js
import * as dayjs from 'dayjs'
import * as localizedFormat from 'dayjs/plugin/localizedFormat'
import 'dayjs/locale/en'
import 'dayjs/locale/nl'
dayjs.extend(localizedFormat);
dayjs.locale(window.config.locale);
document.querySelectorAll('time').forEach($e => {
$e.innerHTML = dayjs($e.dateTime).format('lll');
});
Edited by Henk van Maanen