import React from ‘react’;
import ‘@mobiscroll/react/dist/css/mobiscroll.min.css’;
import { Datepicker, Page, getJson, setOptions, localeFr } from ‘@mobiscroll/react’;
setOptions({
locale: localeFr,
theme: 'windows',
themeVariant: 'light'
});
function Calendrier() {
const min = ‘2022-03-22T00:00’;
const max = ‘2022-09-22T00:00’;
const [datetimeLabels, setDatetimeLabels] = React.useState([]);
const [datetimeInvalid, setDatetimeInvalid] = React.useState([]);
const onPageLoadingDatetime = React.useCallback((event, inst) => {
getDatetimes(event.firstDay, (bookings) => {
setDatetimeLabels(bookings.labels);
setDatetimeInvalid(bookings.invalid);
});
}, []);
const getDatetimes = (d, callback) => {
let invalid = [];
let labels = [];
getJson('https://trial.mobiscroll.com/getbookingtime/?year=' + d.getFullYear() + '&month=' + d.getMonth(), (bookings) => {
for (let i = 0; i < bookings.length; ++i) {
const booking = bookings[i];
const bDate = new Date(booking.d);
if (booking.nr > 0) {
labels.push({
start: bDate,
title: booking.nr + ' SPOTS',
textColor: '#e1528f'
});
invalid = [...invalid, ...booking.invalid];
} else {
invalid.push(d);
}
}
callback({ labels: labels, invalid: invalid });
}, 'jsonp');
}
Hello, I’m trying to change the demo to work on it but it keep crashing when I open the console windows, if I don’t open it it work perfectly fine.
Error: Uncaught TypeError: e is undefined (mobiscroll.react.min.js:2)
Then getting : Uncaught ReferenceError: process is not defined (blank line 49156 > injectedScript:2:13158)
Sorry in advance if the problem can be easily solved, I’m still learned and I’ve been stuck on it for a while now.