Factor out date ranage