Time duration utilities for JavaScript