Refactors time-related functions to go in the appropriate Javascript models