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

Ion2-calendar doesn't provide exact year, month, date in case of Range mode #306

Open
prakashbarik90 opened this issue Jul 16, 2020 · 0 comments

Comments

@prakashbarik90
Copy link

Ionic version: (check one with "x")
[ ] 3.x

Ion2-calendar mode: (check one with "x")
[ ] components mode
[ ] modal mode

I'm submitting a ... (check one with "x")
[ ] bug report

Current behavior:
My HTML Code:

<ion-calendar [(ngModel)]="dateRange" [options]="optionsRange" [type]="'string'" [format]="'YYYY-MM-DD'"
              (onChange)="selectedRangeDates($event)" (onSelectStart)="onSelectStart($event)"
              (onSelectEnd)="onSelectEnd($event)" >
            </ion-calendar>

TS Code:

optionsRange: CalendarComponentOptions = {
    pickMode: 'range'
  };

selectedRangeDates(dates) {
console.log(JSON.parse(JSON.stringify(dates));
}

onSelectStart(dates) {
    console.log("onSelectStart DATES :: " + JSON.stringify(dates));
}

OUTPUT:

onSelectStart DATES ::{"time":1595442600000,"isToday":false,"title":"23","subTitle":"","selected":true,"isLastMonth":false,"isNextMonth":false,"marked":false,"cssClass":"","disable":false,"isFirst":false,"isLast":false}

On the above output i am getting “23” as selected date but instead of 23 i want to get YYYY-MM-DD when on click a single date as start date and dynamically set next 30 days in calendar from the selected date.

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