Refactor the time regexping and move the timeboxes to a separate widget

We use it in a few places now.