I am attempting to use moment.js to set a start_time and end_time default in my backbone model. It looks like this:
backbone_init: function() {
imp.calendar.CalendarEvent = Backbone.Model.extend({
urlRoot: '/#',
initialize: function() {
//if (this.attributes.start_time) {
//console.log(moment.utc(this.attributes.start_time));
//}
},
defaults: {
id: null,
name: "",
start_time: '' function() { moment().format("YYYY-MM-DDTHH:MM:00\Z"); }, // defaults need to be for moment - now
end_time: '' function() { moment().format("YYYY-MM-DDTHH:MM:00\Z"); }, // defaults need to be for moment day + 1
color: "#0066FF",
address_id: 0,
detail: '',
type: '',
is_all_day: 0
}
});
And I believe I am on the right track however I am probably not following correct syntax rules for my start and end_times default values and am getting:
Uncaught SyntaxError: Unexpected token (
As the error.
Does anyone know how to use functions like this to specify my default values? Thanks a lot and I will provide any other info required to make this work