moved time logic on the controller to the directive's controller