mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
swap dates if start > end
This commit is contained in:
parent
adc23bf007
commit
7cd50eccf0
@ -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);
|
return new Tuple<DateTime, DateTime>(start.Value, end.Value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user