Fix date input and make input fields smaller.
This commit is contained in:
parent
cd8ac6a279
commit
c624723582
2 changed files with 3 additions and 4 deletions
|
@ -7,6 +7,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
|
font-size: 0.66em;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ function populate(pnum) {
|
||||||
if (typeof startDate === "undefined") {
|
if (typeof startDate === "undefined") {
|
||||||
startDate = userdata.meta.start || [0,0,0];
|
startDate = userdata.meta.start || [0,0,0];
|
||||||
} else {
|
} else {
|
||||||
startDate[1] -= 1;
|
|
||||||
startDate[2] += 3;
|
startDate[2] += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,11 +122,10 @@ function getTotal(day) {
|
||||||
st = st || null;
|
st = st || null;
|
||||||
day.querySelector(".subtotal").textContent = st;
|
day.querySelector(".subtotal").textContent = st;
|
||||||
return st;
|
return st;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDate(date) {
|
function getDate(date) {
|
||||||
let d = date && new Date(...date) || new Date();
|
let d = date && new Date(...((d)=>{d[1]-=1; return d;})([...date])) || new Date();
|
||||||
return `${String(d.getDate()).padStart(2, "0")}.${String(d.getMonth()+1).padStart(2, "0")}.${d.getFullYear()}`
|
return `${String(d.getDate()).padStart(2, "0")}.${String(d.getMonth()+1).padStart(2, "0")}.${d.getFullYear()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +220,7 @@ function editDate(e, target) {
|
||||||
const page = getIndex(app.children, e);
|
const page = getIndex(app.children, e);
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
let data = target === "meta" && userdata["meta"] || userdata["pages"][page];
|
let data = target === "meta" && userdata["meta"] || userdata["pages"][page];
|
||||||
input.value = getDate(data[target[1]]);
|
input.value = data[target[1]] && getDate(data[target[1]]) || e.textContent;
|
||||||
input.classList = e.classList;
|
input.classList = e.classList;
|
||||||
input.pattern = "[0-9]{2}.[0-9]{2}.[0-9]{4}";
|
input.pattern = "[0-9]{2}.[0-9]{2}.[0-9]{4}";
|
||||||
input.onblur = () => {
|
input.onblur = () => {
|
||||||
|
|
Loading…
Reference in a new issue