Open emmy29 opened 2 years ago
hello @emmy29 did you manage to select startDate only with ngx-daterangepicker-material? It seems to me not supported
hello @emmy29 did you manage to select startDate only with ngx-daterangepicker-material? It seems to me not supported
Hi Anis, I faced this issue after updating the Angular version, so the ngx-daterangepicker-material version was also updated. And the latest version was having this issue. I tried but didn't find anything related to this so I just downgraded the ngx-daterangepicker-material version to 4.0.1 and its working fine for now.
I tried Installing the same version 4.0.1, however I still have this problem when I select only a day and not an interval. My angular is version 8.3.29. But I managed to solve the problem through a method that converts the data to a valid format.
formatDate(e) {
if (e && e.startDate && e.endDate) {
if(e.startDate == e.endDate) {
e.startDate =new Date(e.startDate);
e.endDate = new Date(e.endDate);
}
return {
startDate: moment(e.startDate).toDate() || null,
endDate: moment(e.endDate).toDate() || null
}
} else {
return null;
}
}
Versions
Describe the bug Selecting the start date only and clicking the Apply button convert the dates after the start date into NaN. In month section also shows invalid date.
To Reproduce Steps to reproduce the behavior:
Expected behavior If the end date is not selected it should have set end date same as the start date.
Screenshots
Code <input type="text" name="FilterRange" readonly ngxDaterangepickerMd [dateLimit]="90" [locale]="{format: 'YYYY-MM-DD', separator: ' / '}" [ranges]="ranges" [showClearButton]="true" alwaysShowCalendars="true" keepCalendarOpeningWithRange="true" [(ngModel)]="filterRange" placeholder="Select Date Range"/>