-1

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

ZachyBear
  • 297
  • 3
  • 15

1 Answers1

2

Get rid of the '' before the function declarations after start_time and end_time. This isn't correct syntax.

razorsyntax
  • 339
  • 3
  • 8
  • 42
Chris Franklin
  • 3,864
  • 2
  • 16
  • 19
  • wow...I had tried that in the code and then thought, NO THAT CAN't BE RIGHT!!! I will accept answer in 11 min, thnx <3 – ZachyBear Dec 19 '14 at 20:55