任何人都可以告訴我如何區分backbonejs中的兩個日期選擇器? 我儘量做到一樣,在我的觀點,但它會提醒的NAN:Backbonejs中兩個日期選擇器之間的區別
initialize: function() {
this.model.on("change:auprov",function(){
var datedeb = new Date(this.model.get("auprov"));
var dateret = new Date(this.model.get("deprov"));
var diff_ms = dateret.getTime() - datedeb.getTime();
alert(diff_ms/1000/60/60/24);
//this.model.set({"dureeprov": '5'});
},this);
},
這裏是我的模型的一部分:
deprov:{
type: "DatePicker",
title: "De (Prov.)",
fieldAttrs:{
className:'col-sm-2 deprov'
},
validators: ["required"]
},
auprov:{
type: "DatePicker",
title: "Au (Prov.)",
fieldAttrs:{
className:'col-sm-2 auprov'
},
validators: ["required"]
},
問候
什麼是'this.model.get(「auprov」)'和'this.model.get(「deprov」)'? –