mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
use proper date formatting on form for expiry
This commit is contained in:
parent
66b7df7cde
commit
871bc9f396
@ -5,6 +5,7 @@
|
|||||||
window.invalidPassword = "{{ .strings.reEnterPasswordInvalid }}";
|
window.invalidPassword = "{{ .strings.reEnterPasswordInvalid }}";
|
||||||
window.URLBase = "{{ .urlBase }}";
|
window.URLBase = "{{ .urlBase }}";
|
||||||
window.code = "{{ .code }}";
|
window.code = "{{ .code }}";
|
||||||
|
window.language = "{{ .langName }}";
|
||||||
window.messages = JSON.parse({{ .notifications }});
|
window.messages = JSON.parse({{ .notifications }});
|
||||||
window.confirmation = {{ .confirmation }};
|
window.confirmation = {{ .confirmation }};
|
||||||
window.userExpiryEnabled = {{ .userExpiry }};
|
window.userExpiryEnabled = {{ .userExpiry }};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Modal } from "./modules/modal.js";
|
import { Modal } from "./modules/modal.js";
|
||||||
import { _get, _post, toggleLoader } from "./modules/common.js";
|
import { _get, _post, toggleLoader, toDateString } from "./modules/common.js";
|
||||||
import { loadLangSelector } from "./modules/lang.js";
|
import { loadLangSelector } from "./modules/lang.js";
|
||||||
|
|
||||||
interface formWindow extends Window {
|
interface formWindow extends Window {
|
||||||
@ -46,7 +46,7 @@ if (window.userExpiryEnabled) {
|
|||||||
time.setDate(time.getDate() + window.userExpiryDays);
|
time.setDate(time.getDate() + window.userExpiryDays);
|
||||||
time.setHours(time.getHours() + window.userExpiryHours);
|
time.setHours(time.getHours() + window.userExpiryHours);
|
||||||
time.setMinutes(time.getMinutes() + window.userExpiryMinutes);
|
time.setMinutes(time.getMinutes() + window.userExpiryMinutes);
|
||||||
messageEl.textContent = window.userExpiryMessage.replace("{date}", time.toDateString() + " " + time.toLocaleTimeString());
|
messageEl.textContent = window.userExpiryMessage.replace("{date}", toDateString(time));
|
||||||
setTimeout(calculateTime, 1000);
|
setTimeout(calculateTime, 1000);
|
||||||
};
|
};
|
||||||
calculateTime();
|
calculateTime();
|
||||||
|
@ -15,12 +15,14 @@ export function toDateString(date: Date): string {
|
|||||||
hour: "2-digit",
|
hour: "2-digit",
|
||||||
minute: "2-digit"
|
minute: "2-digit"
|
||||||
};
|
};
|
||||||
if (t12.checked) {
|
if (t12 && t24) {
|
||||||
args1["hour12"] = true;
|
if (t12.checked) {
|
||||||
args2["hour12"] = true;
|
args1["hour12"] = true;
|
||||||
} else if (t24.checked) {
|
args2["hour12"] = true;
|
||||||
args1["hour12"] = false;
|
} else if (t24.checked) {
|
||||||
args2["hour12"] = false;
|
args1["hour12"] = false;
|
||||||
|
args2["hour12"] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return date.toLocaleDateString(locale, args1) + " " + date.toLocaleString(locale, args2);
|
return date.toLocaleDateString(locale, args1) + " " + date.toLocaleString(locale, args2);
|
||||||
}
|
}
|
||||||
|
1
views.go
1
views.go
@ -221,6 +221,7 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
|
|||||||
"userExpiryHours": inv.UserHours,
|
"userExpiryHours": inv.UserHours,
|
||||||
"userExpiryMinutes": inv.UserMinutes,
|
"userExpiryMinutes": inv.UserMinutes,
|
||||||
"userExpiryMessage": app.storage.lang.Form[lang].Strings.get("yourAccountIsValidUntil"),
|
"userExpiryMessage": app.storage.lang.Form[lang].Strings.get("yourAccountIsValidUntil"),
|
||||||
|
"langName": lang,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user