Switching to using moment.js for times in JS, rather than a custom solution. Fixes #688