mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
(hopefully) get proper locale from browser
This commit is contained in:
parent
3e73d16cce
commit
7196361cf6
@ -83,7 +83,7 @@ class user implements User {
|
||||
set last_active(unix: number) {
|
||||
this._lastActiveUnix = unix;
|
||||
if (unix == 0) {
|
||||
this._lastActive.textContent == "";
|
||||
this._lastActive.textContent == "n/a";
|
||||
} else {
|
||||
this._lastActive.textContent = toDateString(new Date(unix*1000));
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ export function createEl(html: string): HTMLElement {
|
||||
}
|
||||
|
||||
export function toDateString(date: Date): string {
|
||||
return date.toLocaleDateString() + " " + date.toLocaleString([], {
|
||||
const locale = (window as any).navigator.userLanguage || window.navigator.language;
|
||||
return date.toLocaleDateString(locale) + " " + date.toLocaleString(locale, {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit"
|
||||
})
|
||||
|
@ -8,7 +8,7 @@ interface updateDTO {
|
||||
|
||||
export class Updater implements updater {
|
||||
private _update: Update;
|
||||
private _date: Date;
|
||||
private _date: number;
|
||||
updateAvailable = false;
|
||||
|
||||
checkForUpdates = (run?: (req: XMLHttpRequest) => void) => _get("/config/update", null, (req: XMLHttpRequest) => {
|
||||
@ -26,10 +26,10 @@ export class Updater implements updater {
|
||||
}
|
||||
}
|
||||
});
|
||||
get date(): number { return Math.floor(this._date.getTime() / 1000); }
|
||||
get date(): number { return this._date; }
|
||||
set date(unix: number) {
|
||||
this._date = new Date(unix * 1000);
|
||||
document.getElementById("update-date").textContent = toDateString(this._date);
|
||||
this._date = unix;
|
||||
document.getElementById("update-date").textContent = toDateString(new Date(this._date * 1000));
|
||||
}
|
||||
|
||||
get description(): string { return this._update.description; }
|
||||
|
Loading…
Reference in New Issue
Block a user