Add flatten_date_array method to dry out the date creating logic.