Custom Helpers

The sighting’s sightedAt date property is displayed as an ugly raw date string. To format your dates more nicely, you are going to use the same moment library you used in Chattrbox.

Add moment from the terminal:

bower install moment --save

Then, use app.import to add moment to your vendor assets in ember-cli-build.js:

...
  // Add assets to app with import
  app.import(bootstrapPath + 'javascripts/bootstrap.js');
  app.import('bower_components/moment/moment.js');

  return app.toTree();
};

Changes to your server configurations require a restart, so after you change the ember-cli-build.js, stop your Ember server (Control+C) and start it back up (ember server).

Now you need to generate the helper module from the terminal: ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.