forked from forgejo/forgejo
Set user's 24h preference from their current OS locale (#29651)
Fixes: https://github.com/go-gitea/gitea/issues/28371 Fixed by using a JS solution that formats according to `lang`, but alters the 24h format setting as per user's locale. This will work for all tooltips: <img width="243" alt="Screenshot 2024-03-07 at 23 03 35" src="6d16c71c
-6786-4eda-8cdc-50ec68ba62c6"> <img width="250" alt="Screenshot 2024-03-07 at 23 03 17" src="4e26bbb7
-12df-4b81-bd37-14705e87e8f7"> <img width="310" alt="Screenshot 2024-03-07 at 23 14 34" src="1ef599f0
-6401-4e19-b1da-59cdfc09b0f6"> I think there is only one other place in the UI where we render such absolute dates, which is in the actions view and which I've also fixed: <img width="275" alt="Screenshot 2024-03-07 at 23 04 00" src="df0fbe1f
-96ee-4338-ab5e-2b10e215005d"> (cherry picked from commit f86e9a03673b70d660a4b7a1e53748757d7a45fa)
This commit is contained in:
parent
3d9afe8813
commit
427ab550a6
3 changed files with 32 additions and 3 deletions
|
@ -3,7 +3,7 @@ import {SvgIcon} from '../svg.js';
|
|||
import ActionRunStatus from './ActionRunStatus.vue';
|
||||
import {createApp} from 'vue';
|
||||
import {toggleElem} from '../utils/dom.js';
|
||||
import {getCurrentLocale} from '../utils.js';
|
||||
import {formatDatetime} from '../utils/time.js';
|
||||
import {renderAnsi} from '../render/ansi.js';
|
||||
import {POST, DELETE} from '../modules/fetch.js';
|
||||
|
||||
|
@ -170,7 +170,7 @@ const sfc = {
|
|||
const logTimeStamp = document.createElement('span');
|
||||
logTimeStamp.className = 'log-time-stamp';
|
||||
const date = new Date(parseFloat(line.timestamp * 1000));
|
||||
const timeStamp = date.toLocaleString(getCurrentLocale(), {timeZoneName: 'short'});
|
||||
const timeStamp = formatDatetime(date);
|
||||
logTimeStamp.textContent = timeStamp;
|
||||
toggleElem(logTimeStamp, this.timeVisible['log-time-stamp']);
|
||||
// for "Show seconds"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue