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

Class constructor CalendarDateFormatter cannot be invoked without 'new' in Angular v15+ with es5 as target in tsconfig. #1636

Open RaviHadalgi opened 1 year ago

RaviHadalgi commented 1 year ago

Describe the bug

Class constructor CalendarDateFormatter cannot be invoked without 'new' in angular 15 version, working in earlier version of angular.

tsconfig:
"target": "es5", I want the target to be in es5.

Used as below: @Injectable() export class CustomDateFormatter extends CalendarDateFormatter { public monthViewColumnHeader({ date, locale }: DateFormatterParams): string { return formatDate(date, 'EEEEEE', locale); 
 }
 }

as defined in node_modules/angular-calendar/modules/common/calendar-date-formatter.provider.d.ts.

Defined in component selector: 'app-calendar-view',
 templateUrl: './calendar-view.component.html', 
styleUrls: ['./calendar-view.component.scss'],
 providers: [
 { 
provide: CalendarDateFormatter, 
useClass: CustomDateFormatter},
 ], 
} )

Minimal reproduction of the problem with instructions

Screenshots image

Versions

Updating target to es6 works fine, but i am constrained from updating to es6. Please help, on how to run the calendar with Ang15+ version having target set to es5.

matts-bot[bot] commented 1 year ago

Thanks so much for opening an issue! If you'd like to support this project, then please consider sponsoring me