You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ionic version: (check one with "x")
[ ] 2.x
[ ] 3.x
[ ] 4.x
[ x ] 5.x
Ion2-calendar mode: (check one with "x")
[ x ] components mode
[ ] modal mode
I'm submitting a ... (check one with "x")
[ x ] bug report
[ ] feature request
[ ] help me
Current behavior:
I pass a "daysConfig" array, with "marked": true when using the component in "MULTI" mode. The days passed are marked in "green" colour but are NOT "selected" and are not included in the array returned by the component in the ngModel array bound.
Expected behavior:
The days in "daysConfig" should be marked as "selected" and returned in the array bound.
Steps to reproduce:
Related code:
CONTROLLER:
public dateMulti: string[] = [];
public type: 'string';
public daysConfig: DayConfig[] = [];
public optionsMulti = {
pickMode: "multi",
title: 'Select dates',
weekStart: 1,
daysConfig: []
}
ngOnInit() {
for (let d in this.dates) {
this.daysConfig.push({
date: new Date(this.dates[d]),
marked: true
})
}
if (this.daysConfig.length > 0) {
this.optionsMulti.daysConfig = this.daysConfig;
}
}
Answering my own question, the daysConfig just "marks" the dates, with possible text as well, it does not add them to the returned array. However if you pre-populate the bound array with the dates that should be "pre-selected", they are marked as such on the calendar, and they are returned in the array back together with newly added dates (or removed if you de-select them)
Ionic version: (check one with "x")
[ ] 2.x
[ ] 3.x
[ ] 4.x
[ x ] 5.x
Ion2-calendar mode: (check one with "x")
[ x ] components mode
[ ] modal mode
I'm submitting a ... (check one with "x")
[ x ] bug report
[ ] feature request
[ ] help me
Current behavior:
I pass a "daysConfig" array, with "marked": true when using the component in "MULTI" mode. The days passed are marked in "green" colour but are NOT "selected" and are not included in the array returned by the component in the ngModel array bound.
Expected behavior:
The days in "daysConfig" should be marked as "selected" and returned in the array bound.
Steps to reproduce:
Related code:
CONTROLLER:
public dateMulti: string[] = [];
public type: 'string';
public daysConfig: DayConfig[] = [];
public optionsMulti = {
pickMode: "multi",
title: 'Select dates',
weekStart: 1,
daysConfig: []
}
ngOnInit() {
for (let d in this.dates) {
this.daysConfig.push({
date: new Date(this.dates[d]),
marked: true
})
}
if (this.daysConfig.length > 0) {
this.optionsMulti.daysConfig = this.daysConfig;
}
}
HTML:
<ion-calendar
[(ngModel)] = "dateMulti"
[options] = "optionsMulti"
[type] = "type"
(change) = "calChange($event)"
[format] = "'YYYY-MM-DD'">
Other information:
Ionic info: (run
ionic info
from a terminal/cmd prompt and paste output below):Ionic:
Ionic CLI : 6.16.3 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.2
@angular-devkit/build-angular : 0.901.13
@angular-devkit/schematics : 9.0.3
@angular/cli : 9.1.13
@ionic/angular-toolkit : 2.3.3
Capacitor:
Capacitor CLI : 2.4.6
@capacitor/android : 2.4.6
@capacitor/core : 2.4.6
@capacitor/ios : 2.4.6
Utility:
cordova-res : not installed globally
native-run (update available: 1.4.0) : 0.3.0
System:
NodeJS : v14.15.1 (/usr/local/bin/node)
npm : 7.20.0
OS : macOS Big Sur
The text was updated successfully, but these errors were encountered: