Type ‘DateTimeTimeZone’ is not assignable to type ‘Date’ in Angular 11

I have a problem after updating my entire Angular project where suddenly I get "No overload matches this call." and the error reading "Type ‘DateTimeTimeZone’ is not assignable to type ‘Date’."

This seems to happen to my Date formatting functions:

  formattingDate(dateTime: DateTimeTimeZone): String {
    try {
      return (this.datepipe.transform(dateTime, 'dd MMMM yyyy'));
    catch (error) {
      this.alertsService.add('DateTimeTimeZone conversion error', JSON.stringify(error));

While DateTimeTimeZone contains this:

// https://docs.microsoft.com/graph/api/resources/datetimetimezone?view=graph-rest-1.0
export class DateTimeTimeZone {
  dateTime: string;
  timeZone: string;

Is there a quick and easy solution to this?
I wouldn’t know where to start.

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.