Open Deepan-kishore opened 5 days ago
I could not assign this to anyone. The option shows to be disabled for me.
For some reason, when I create a separate TS project from scratch and use the example in readme.md, this issue arises. But it's working fine when I clone it from this Repository.
I encountered an issue with the example code provided in the @bitnoi.se/react-scheduler README. It seems that there are missing imports and setup that result in errors when trying to run the example.
Steps to Reproduce:
Install the @bitnoi.se/react-scheduler library by running: -
npm install @bitnoi.se/react-scheduler dayjs
Copy the example code from the README into a React component: `import { Scheduler, SchedulerData } from "@bitnoi.se/react-scheduler"; import dayjs from "dayjs";
default export function Component() { const [filterButtonState, setFilterButtonState] = useState(0);
const [range, setRange] = useState({ startDate: new Date(), endDate: new Date() });
const handleRangeChange = useCallback((range) => { setRange(range); }, []);
const filteredMockedSchedulerData = mockedSchedulerData.map((person) => ({ ...person, data: person.data.filter( (project) => dayjs(project.startDate).isBetween(range.startDate, range.endDate) || dayjs(project.endDate).isBetween(range.startDate, range.endDate) || (dayjs(project.startDate).isBefore(range.startDate, "day") && dayjs(project.endDate).isAfter(range.endDate, "day")) ) }))
return (
); }
const mockedSchedulerData = [...] // Same as the example data in the README `
Attempt to run the project, and you'll encounter the following errors: -The isBetween function is not recognized.
To resolve this, you need to import and extend isBetween from dayjs:
import isBetween from "dayjs/plugin/isBetween"; dayjs.extend(isBetween);