diff --git a/src/Api/Controllers/EventsController.cs b/src/Api/Controllers/EventsController.cs index 7309498f78..700fecaa95 100644 --- a/src/Api/Controllers/EventsController.cs +++ b/src/Api/Controllers/EventsController.cs @@ -74,9 +74,16 @@ namespace Bit.Api.Controllers } } - if(start.Value > end.Value || (end.Value - start.Value) > TimeSpan.FromDays(32)) + if(start.Value > end.Value) { - throw new BadRequestException("Invalid date range."); + var newEnd = start; + start = end; + end = newEnd; + } + + if((end.Value - start.Value) > TimeSpan.FromDays(367)) + { + throw new BadRequestException("Range too large."); } return new Tuple(start.Value, end.Value);