Code working for inclusive / exclusive date ranges