我在Typescript中有以下代码:
var period = self.getPeriod(someObject.createdTime);
//createdTime is of the type Date
getPeriod(date: Date){
let today = new Date();
today.getTime(); // works fine
date.getTime(); // date.gettime() is not a function
//rest of the code removed
}
我在做什么错?如果我尝试在someObject.createdTime.ToUTCString()中传递字符串,则会抛出createdTime.toUTCString()不是函数。
答案 0 :(得分:0)
var period = self.getPeriod(new Date());
getPeriod(date: Date){
let today = new Date();
today.getTime();
date.getTime();
}