import { Component , Input } from '@angular/core' ; @ Component ( { selector : 'input-date' , template : `<input type="date" [value]="date | date:'yyyy-MM-dd'" (change)="date = $event.target.value"
  [min]="min" [max]="max">` } ) export class InputDateComponent { @ Input ( ) model : { [ key ] : any ; } ; @ Input ( ) property : string ; @ Input ( ) min : string ; @ Input ( ) max : string ; get date ( ) { return this . model [ this . property ] ; } set date ( value ) { const newDate = new Date ( value ) ; if ( ! isNaN ( newDate . getFullYear ( ) ) ) { this . model [ this . property ] = newDate ; } } }