This commit is contained in:
parent
42852805e0
commit
a77a04bcdf
@ -342,7 +342,8 @@ export const getMenuZastavkaUmichala = async (firstDayOfWeek: Date, mock: boolea
|
|||||||
return getMenuZastavkaUmichalaMock();
|
return getMenuZastavkaUmichalaMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
const nowDate = new Date().getDate();
|
const today = new Date();
|
||||||
|
today.setHours(0,0,0,0);
|
||||||
const headers = {
|
const headers = {
|
||||||
"Cookie": "_nss=1; PHPSESSID=9e37de17e0326b0942613d6e67a30e69",
|
"Cookie": "_nss=1; PHPSESSID=9e37de17e0326b0942613d6e67a30e69",
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
|
||||||
@ -351,8 +352,8 @@ export const getMenuZastavkaUmichala = async (firstDayOfWeek: Date, mock: boolea
|
|||||||
for (let dayIndex = 0; dayIndex < 5; dayIndex++) {
|
for (let dayIndex = 0; dayIndex < 5; dayIndex++) {
|
||||||
const currentDate = new Date(firstDayOfWeek);
|
const currentDate = new Date(firstDayOfWeek);
|
||||||
currentDate.setDate(firstDayOfWeek.getDate() + dayIndex);
|
currentDate.setDate(firstDayOfWeek.getDate() + dayIndex);
|
||||||
|
currentDate.setHours(0,0,0,0);
|
||||||
if (currentDate.getDate() < nowDate || (currentDate.getDate() === nowDate && new Date().getHours() >= 14)) {
|
if (currentDate < today || (currentDate.getTime() === today.getTime() && new Date().getHours() >= 14)) {
|
||||||
result[dayIndex] = [{
|
result[dayIndex] = [{
|
||||||
amount: undefined,
|
amount: undefined,
|
||||||
name: "Pro tento den není uveřejněna nabídka jídel",
|
name: "Pro tento den není uveřejněna nabídka jídel",
|
||||||
@ -360,8 +361,9 @@ export const getMenuZastavkaUmichala = async (firstDayOfWeek: Date, mock: boolea
|
|||||||
isSoup: false,
|
isSoup: false,
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
const url = (currentDate.getDate() === nowDate) ?
|
const url = (currentDate.getTime() === today.getTime())
|
||||||
ZASTAVKAUMICHALA_URL : ZASTAVKAUMICHALA_URL + '/?do=dailyMenu-changeDate&dailyMenu-dateString=' + formatDate(currentDate, 'DD.MM.YYYY');
|
? ZASTAVKAUMICHALA_URL
|
||||||
|
: ZASTAVKAUMICHALA_URL + '/?do=dailyMenu-changeDate&dailyMenu-dateString=' + formatDate(currentDate, 'DD.MM.YYYY');
|
||||||
const html = await axios.get(url, {
|
const html = await axios.get(url, {
|
||||||
headers,
|
headers,
|
||||||
}).then(res => res.data).then(content => content);
|
}).then(res => res.data).then(content => content);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user