Manage time in javascript.