Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'MULTI' mode, daysConfig passed as marked, are not marked as 'selected' and are not included in the returned dates values #334

Closed
chrisvor opened this issue Jul 29, 2021 · 1 comment

Comments

@chrisvor
Copy link

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

@chrisvor
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant