2
down vote
favorite
I have some questions about datetime picker in ionic 2:
- what variable to store the datetime when i choose it? i add my the code from my project that i just try to store it in some variables without succcessful
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import {DatePicker} from ‘ionic-native’;
import {Calendar} from ‘ionic-native’;
import {Platform} from ‘ionic-angular’;
import { Pipe } from ‘@angular/core’;
/*
Generated class for the InviteDates page.
See Ionic Demo: UI Components & API Customization to Create Interface for more info on
Ionic pages and navigation.
*/
@Component({
selector: ‘page-invite-dates’,
templateUrl: ‘invite-dates.html’
})
export class InviteDates {
dateshow:any;
newdate:any;
d:any;
b:any;
year:any;
month:any;
day:any;
today:Date;
mydate: String = new Date().toISOString();
constructor(public navCtrl: NavController,private platform:Platform) { this.d="";
}
ionViewDidLoad() {
console.log(‘Hello InviteDates Page’);
this.datefun();
}
}
the html file
<ion-content padding>
<ion-item> <ion-label>Date</ion-label> <ion-datetime displayFormat="DD/MM/YYYY" [(ngModel)]="mydate"></ion-datetime> <p> the date is :{{mydate}}</p>
</ion-item>
2.i want 3datetime:
- #1 datetime of the current date
- #2 datetime of chosen date
- #3 datetime of the time the user chosen how to do that?
3.how can i limit the dates? i mean, the user can’t choose from past, just a week from today for example.