function dataURLtoFile(dataurl, filename) {
let arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, { type: mime });
}
saveScanStat.onclick = () => {
let now = new Date()
let dataForLS = {}
dataForLS = JSON.parse(localStorage.getItem(`sostav${sostav}`))
if (dataForLS == null) {
dataForLS = {}
}
dataForLS[docId] = {
day: `${now.getDate()}`,
month: `${1 + now.getMonth()}`,
a40: `${a40}`
}
localStorage.setItem(`sostav${sostav}`, JSON.stringify(dataForLS))
}
let dataForLS = {}
let sostavNumber = document.querySelector("#b-footer > div > div:nth-child(2) > input:nth-child(2)").value
dataForLS = JSON.parse(localStorage.getItem(`sostav${sostavNumber}`))
let counter = {}
let needMonth = Number(document.querySelector("#month").value.substr(5, 7))
for (let key in dataForLS) {
if (dataForLS[key].month == needMonth) {
if (counter[dataForLS[key].day] == null) {
counter[dataForLS[key].day] = 0
}
counter[dataForLS[key].day]++
}
}
console.log(counter);
}