Convert javacript time handling to moment.js

Change-Id: I255e3d0e3cb2dd9ee61098230ac9f234db479e66