angular 2 how to disable days untill today in datepicker? -


i'm using datepicker here https://github.com/kekeh/mydatepicker/blob/master/readme.md , need disable dates until today need current day month , year , pass mydatepickeroptions used new date() function date in i'm getting (thu apr 06 2017 15:55:09 gmt+0530 (india standard time) can't use mydatepickeroptions how can day month , year? have tried following code.

import { component, oninit,viewencapsulation } '@angular/core'; import { headercomponent }  '../header/header.component'; import {imyoptions, imydatemodel,imydate} 'mydatepicker'; import { timepickerconfig } 'ng2-bootstrap/timepicker'; import { formgroup,formcontrol,validators } '@angular/forms';  @component({   selector: 'app-createsession',   templateurl: './createsession.component.html',   styleurls: ['./createsession.component.css'],   encapsulation: viewencapsulation.none }) export class createsessioncomponent implements oninit {    eventform : formgroup ;    public mytime: date = new date();    private mydatepickeroptions: imyoptions = {         //  need use current day,month , year           disableuntil: {year: 2016, month: 8, day: 10},         dateformat: 'dd.mm.yyyy'     };   constructor() { }    ngoninit() {     console.log(this.mytime);      });    }   ondatechanged(event: imydatemodel) {         // event properties are: event.date, event.jsdate, event.formatted , event.epoc     }        onsubmit(){   console.log(this.eventform.value); } } 

extract date, year , month current date , set disableuntil property.

public mytime: date = new date();  currentyear: = this.mytime.getutcfullyear(); currentdate: = this.mytime.getutcdate(); currentmonth: = this.mytime.getutcmonth() + 1; //months 1-12  private mydatepickeroptions: imyoptions = {     //  need use current day,month , year       disableuntil: {year: this.currentyear, month: this.currentmonth, day: this.currentdate},     dateformat: 'dd.mm.yyyy' }; 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -