Ion-datetime highlightedDates

I have been trying to use ion-datetime wit highlightedDates but it gives me ths error:
PD: im following the documentation.


How I can solve it?
Ionic version: 6.20.9

This is my HTML code
<ion-popover #popover side="left" alignment="start" class="pop-over"> <ng-template> <ion-datetime [highlightedDates]="highlightedDates" id="calendar" presentation="date" preferWheel="false" value="2023-03-01" [showDefaultButtons]="false" multiple="true" ></ion-datetime> </ng-template> </ion-popover>

My typescript Code:
`
import { Component, OnInit, ViewChild } from β€˜@angular/core’;
import { ItemReorderEventDetail, IonPopover } from β€˜@ionic/angular’;
export class DatesPage implements OnInit {

public trip: Trip;
public selectedButton: number = 0;
private calendarOpened: boolean = false;
public rangesDates: any = ;
highlightedDates = [
{
date: β€˜2023-03-05’,
textColor: β€˜#800080’,
backgroundColor: β€˜#ffc0cb’,
},
{
date: β€˜2023-03-10’,
textColor: β€˜#09721b’,
backgroundColor: β€˜#c8e5d0’,
},
{
date: β€˜2023-03-20’,
textColor: β€˜var(–ion-color-secondary-contrast)’,
backgroundColor: β€˜var(–ion-color-secondary)’,
},
{
date: β€˜2023-03-23’,
textColor: β€˜rgb(68, 10, 184)’,
backgroundColor: β€˜rgb(211, 200, 229)’
}
];
}
`

Hi,

The highlightedDates was added in Ionic 6.6.0 (Related PR), so you might check if your installed Ionic framework version is greater than 6.6.0

One thing to notice, the ionic -v command will print the version of @ionic/cli (6.20.9), not the actual installed Ionic framework version.

The proper way to check the version number is by using ionic info command.

1 Like