AG
хоть самому написать, хоть на джанго-формах
Size: a a a
AG
AG
AK
AK
AK
AG
AG
AG
AK
СЧ
AK
AK
СЧ
СЧ
AK
СЧ
AK
СЧ
function checkDateIsWorking(dateUnixFormatted) {
if (isNaN(Date.parse(dateUnixFormatted)) === true) {
return "date is not valid\nformat UTC or Date.now()"
}
dateUnixFormatted = new Date(dateUnixFormatted).toISOString().slice(0, 10).replace(/-/g, '');
let urlServer = "https://isdayoff.ru/" + dateUnixFormatted;
let xhr = new XMLHttpRequest();
xhr.open('GET', urlServer, false);
xhr.send();
if (xhr.status !== 200) {
if (xhr.status === 400 && "100" === xhr.statusText) {
console.log("date is not valid\nformat YYYYMMDD");
return "date is not valid\nformat YYYYMMDD";
}
if (xhr.status === 404 && "101" === xhr.statusText) {
console.log("data not Found")
return "data not Found";
}
// Error, Output Example: 404: Not Found
console.log(xhr.status + ': ' + xhr.statusText);
} else // return xhr.status + ': ' + xhr.statusText;
{
return xhr.responseText === '0';
}
}
async function findNextWorkingDay(startDay) {
if (isNaN(Date.parse(startDay))) {
return "date is not valid\nformat UTC or Date.now()"
}
let date = new Date(startDay);
let count = 0;
while (true) {
date.setDate(date.getDate() + 1)
const run = await checkDateIsWorking(date);
if (run)
return date;
count++;
if (count > 10) {
return NaN;
}
}
}
// return date;
СЧ
function checkDateIsWorking(dateUnixFormatted) {
if (isNaN(Date.parse(dateUnixFormatted)) === true) {
return "date is not valid\nformat UTC or Date.now()"
}
dateUnixFormatted = new Date(dateUnixFormatted).toISOString().slice(0, 10).replace(/-/g, '');
let urlServer = "https://isdayoff.ru/" + dateUnixFormatted;
let xhr = new XMLHttpRequest();
xhr.open('GET', urlServer, false);
xhr.send();
if (xhr.status !== 200) {
if (xhr.status === 400 && "100" === xhr.statusText) {
console.log("date is not valid\nformat YYYYMMDD");
return "date is not valid\nformat YYYYMMDD";
}
if (xhr.status === 404 && "101" === xhr.statusText) {
console.log("data not Found")
return "data not Found";
}
// Error, Output Example: 404: Not Found
console.log(xhr.status + ': ' + xhr.statusText);
} else // return xhr.status + ': ' + xhr.statusText;
{
return xhr.responseText === '0';
}
}
async function findNextWorkingDay(startDay) {
if (isNaN(Date.parse(startDay))) {
return "date is not valid\nformat UTC or Date.now()"
}
let date = new Date(startDay);
let count = 0;
while (true) {
date.setDate(date.getDate() + 1)
const run = await checkDateIsWorking(date);
if (run)
return date;
count++;
if (count > 10) {
return NaN;
}
}
}
// return date;
AK
function checkDateIsWorking(dateUnixFormatted) {
if (isNaN(Date.parse(dateUnixFormatted)) === true) {
return "date is not valid\nformat UTC or Date.now()"
}
dateUnixFormatted = new Date(dateUnixFormatted).toISOString().slice(0, 10).replace(/-/g, '');
let urlServer = "https://isdayoff.ru/" + dateUnixFormatted;
let xhr = new XMLHttpRequest();
xhr.open('GET', urlServer, false);
xhr.send();
if (xhr.status !== 200) {
if (xhr.status === 400 && "100" === xhr.statusText) {
console.log("date is not valid\nformat YYYYMMDD");
return "date is not valid\nformat YYYYMMDD";
}
if (xhr.status === 404 && "101" === xhr.statusText) {
console.log("data not Found")
return "data not Found";
}
// Error, Output Example: 404: Not Found
console.log(xhr.status + ': ' + xhr.statusText);
} else // return xhr.status + ': ' + xhr.statusText;
{
return xhr.responseText === '0';
}
}
async function findNextWorkingDay(startDay) {
if (isNaN(Date.parse(startDay))) {
return "date is not valid\nformat UTC or Date.now()"
}
let date = new Date(startDay);
let count = 0;
while (true) {
date.setDate(date.getDate() + 1)
const run = await checkDateIsWorking(date);
if (run)
return date;
count++;
if (count > 10) {
return NaN;
}
}
}
// return date;