mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
format code + fix date empty error
This commit is contained in:
@@ -1,37 +1,34 @@
|
||||
$(document).ready(function () {
|
||||
$.post("http://esx_identity/ready", JSON.stringify({}));
|
||||
$.post('http://esx_identity/ready', JSON.stringify({}));
|
||||
|
||||
window.addEventListener("message", function (event) {
|
||||
if (event.data.type === "enableui") {
|
||||
window.addEventListener('message', function (event) {
|
||||
if (event.data.type === 'enableui') {
|
||||
event.data.enable ? $(document.body).show() : $(document.body).hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#register").submit(function (event) {
|
||||
$('#register').submit(function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
const dateCheck = new Date($("#dateofbirth").val());
|
||||
const dofVal = $('#dateofbirth').val();
|
||||
if (!dofVal) return;
|
||||
|
||||
const year = new Intl.DateTimeFormat("en", { year: "numeric" }).format(
|
||||
dateCheck
|
||||
);
|
||||
const month = new Intl.DateTimeFormat("en", { month: "2-digit" }).format(
|
||||
dateCheck
|
||||
);
|
||||
const day = new Intl.DateTimeFormat("en", { day: "2-digit" }).format(
|
||||
dateCheck
|
||||
);
|
||||
const dateCheck = new Date(dofVal);
|
||||
|
||||
const year = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(dateCheck);
|
||||
const month = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(dateCheck);
|
||||
const day = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(dateCheck);
|
||||
|
||||
const formattedDate = `${day}/${month}/${year}`;
|
||||
|
||||
$.post(
|
||||
"http://esx_identity/register",
|
||||
'http://esx_identity/register',
|
||||
JSON.stringify({
|
||||
firstname: $("#firstname").val(),
|
||||
lastname: $("#lastname").val(),
|
||||
firstname: $('#firstname').val(),
|
||||
lastname: $('#lastname').val(),
|
||||
dateofbirth: formattedDate,
|
||||
sex: $("input[type='radio'][name='sex']:checked").val(),
|
||||
height: $("#height").val(),
|
||||
height: $('#height').val(),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user