mattlewis92 / angular-calendar

A flexible calendar component for angular 15.0+ that can display events on a month, week or day view.
https://mattlewis-github.com/angular-calendar/
MIT License
2.71k stars 863 forks source link

DateAdapter not working properly #1646

Closed jacopo-degattis closed 1 year ago

jacopo-degattis commented 1 year ago

Hello everyone,

I'm currently testing this calendar library and I stumbled upon a problem.

I defined my calendar.module.ts with the following imports and the current module definition.

import { CalendarModule, DateAdapter, CalendarDateFormatter } from 'angular-calendar';
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';

CalendarModule.forRoot({
    provide: DateAdapter,
    useFactory: adapterFactory
})

However when I use the draggable events feature an error popup in the console saying that changeDays is not a function.

The error happens in the following portion of code inside the library:

const changeDays = days < 0 ? dateAdapter.subDays : dateAdapter.addDays;
let result = date;
while (daysToAdd <= Math.abs(days)) {
    result = changeDays(date, daysCounter);

It seems like the 'dataAdapter' is missing the 'addDays' and 'subDays' functions. I tried everything I could but I couldn't figure out the problem.

Thank you so much.

matts-bot[bot] commented 1 year ago

This issue has been closed automatically as it did not follow the issue template, please open a new issue that follows the bug report or feature request template.

Thank you! ✌️