我在我的django模型中有models.DateTimeField()
字段。django tastypie和backbone的日期
我正在使用骨幹來顯示此模型。我希望能夠漂亮地打印日期。
我嘗試以下,但它說無效日期:
App.House = Backbone.Model.extend({
url: function() {
return API_URL + this.id;
},
initialize: function() {
// displays Invalid Date when printed in template
this.set('pretty_created_at',new Date(this.get('created_at')));
},
});
當從服務器API響應看,我看到日期的格式如下:
"created_at": "2012-06-24T05:00:00+00:00"