refactor time parsing
add some more tests