Simple javascript interval converter