mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
swap dates if start > end
This commit is contained in:
@ -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<DateTime, DateTime>(start.Value, end.Value);
|
||||
|
Reference in New Issue
Block a user