我有日期作为日期对象。角度js:操作对象的值
当我这样做
$scope.test = new Date([2017,2,15]);
<pre>{{test}}</pre>
<pre>{{test.getDate()}}</pre>
我得到
“2017-02-14T23:00:00.000Z” 和15
所以到这里,我们是很好的。
但在我而言,当我尝试做相同的日期whitch是在另一个物体像在这个模式:
var tachesSchema = new mongoose.Schema({
title : String,
start: {type: Date, default: new Date()},
end: {type: Date, default: new Date()},
comment : String,
state : Boolean,
projet : { type: ObjectId, ref: 'Projets' }
});
我得到什么:(
此代码:
{{tache.start}}
显示的日期是这样 “2017-02-20T23:00:00.000Z”
但
<pre>{{tache.start.getDate()}}</pre>
什么都不显示。
我错过了什么?
编辑
我省略了精确的,我想这样做在NG-重复
下面的代码给我喜欢约会“2017-02-20T23:00:00.000Z”
<pre ng-repeat="tache in taches">
{{tache.start}}
</pre>
下面的代码给我什么
<pre ng-repeat="tache in taches">
{{tache.start.getDay()}}
</pre>
感谢您的帮助。我已经尝试过,但它没有改变任何东西:( –