define(function (require) {

  var moment = require('moment'),
      AppDispatcher = require('dispatchers/AppDispatcher'),
      ImageConstants = require('constants/ImageConstants');

  return {

    updateImageAttributes: function (image, newAttributes) {
      if(newAttributes.end_date != null) {
        var end_date;
        if (typeof newAttributes.end_date === "object") {
            end_date = newAttributes.end_date
        } else {
            end_date = moment(newAttributes.end_date);
        }
        newAttributes.end_date = end_date;
      }
      image.set({
        name: newAttributes.name,
        description: newAttributes.description,
        end_date: newAttributes.end_date,
        tags: newAttributes.tags
      });
      AppDispatcher.handleRouteAction({
        actionType: ImageConstants.IMAGE_UPDATE,
        payload: {image: image}
      });
    }

  };

});

define(function (require) {

  var moment = require('moment'),
      AppDispatcher = require('dispatchers/AppDispatcher'),
      ImageConstants = require('constants/ImageConstants');

  return {

    updateImageAttributes: function (image, newAttributes) {
      if(newAttributes.end_date != null) {
        var end_date;
        if (typeof newAttributes.end_date === "object") {
            end_date = newAttributes.end_date
        } else {
            end_date = moment(newAttributes.end_date, "M/DD/YYYY hh:mm a z");
        }
        newAttributes.end_date = end_date;
      }
      image.set({
        name: newAttributes.name,
        description: newAttributes.description,
        end_date: newAttributes.end_date,
        tags: newAttributes.tags
      });
      AppDispatcher.handleRouteAction({
        actionType: ImageConstants.IMAGE_UPDATE,
        payload: {image: image}
      });
    }

  };

});

Include format when constructing moment.js object
Include format when constructing moment.js object

Constructing a new instance of `moment` without a format string will
cause a deprecation warning:

```
Deprecation warning: moment construction falls back to js Date. This
is discouraged and will be removed in upcoming major release. Please
refer to https://github.com/moment/moment/issues/1407 for more info.
```

Specifically, the resolution is mentioned here:

https://github.com/moment/moment/issues/1407#ref-issue-32451744

So, instead of this, `moment('2/19/2018 10:34 am MST')`, you need to
to include the format that you passing in:

```
var endDate = moment('2/19/2018 10:34 am MST', 'M/DD/YYYY hh:mm a z');
```

Or alse, 1) used ISO format, 2) you can wrap the string in a JS `Date`

(cherry picked from commit 3d81065966f6dde3fd69a7c89bf1ca9bceebd0a6)
