PrimeNG angular 2 CLI项目Datepicker

时间:2017-12-18 17:16:23

标签: angular primeng

如何使用Component.ts中的PrimeNG模块角度将日期转换为字符串?

Argument of type 'Dateconstructor' is not assignable to parameter of type 'Date'. Property 'toDateString' is missing in type 'DateConstructor'

到目前为止这是我的剧本

component.ts

import {CalendarModule} from 'primeng/primeng';
import {SearchLite} from '../room';
export class HomeComponent implements OnInit {

selected_date = Date;
  SearchLite = new SearchLite ( '',this.selected_date,'','',this.guest,this.room,'' );
}

Room.ts

export class SearchLite{
constructor
(
    public place:string,
    public date:Date,
    public duration_start:string,
    public duration_end:string,
    public guest:number,
    public room:number,
    public position:string
){}

}

component.html

<p-calendar [(ngModel)]="selected_date" dateFormat="dd.mm.yy" [inline]="true"></p-calendar>

0 个答案:

没有答案