mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 05:28:15 -05:00
handle UTC dates properly for events
This commit is contained in:
parent
a9f232746e
commit
79d46578b0
@ -58,23 +58,12 @@ namespace Bit.Api.Controllers
|
|||||||
|
|
||||||
private Tuple<DateTime, DateTime> GetDateRange(DateTime? start, DateTime? end)
|
private Tuple<DateTime, DateTime> GetDateRange(DateTime? start, DateTime? end)
|
||||||
{
|
{
|
||||||
var endSet = false;
|
if(!end.HasValue || !start.HasValue)
|
||||||
if(!end.HasValue)
|
|
||||||
{
|
{
|
||||||
endSet = true;
|
|
||||||
end = DateTime.UtcNow.Date.AddDays(1).AddMilliseconds(-1);
|
end = DateTime.UtcNow.Date.AddDays(1).AddMilliseconds(-1);
|
||||||
|
start = DateTime.UtcNow.Date.AddDays(-30);
|
||||||
}
|
}
|
||||||
|
else if(start.Value > end.Value)
|
||||||
if(!start.HasValue)
|
|
||||||
{
|
|
||||||
start = end.Value.AddDays(-30);
|
|
||||||
if(endSet)
|
|
||||||
{
|
|
||||||
start = start.Value.AddMilliseconds(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(start.Value > end.Value)
|
|
||||||
{
|
{
|
||||||
var newEnd = start;
|
var newEnd = start;
|
||||||
start = end;
|
start = end;
|
||||||
|
@ -417,7 +417,7 @@ namespace Bit.Core.Utilities
|
|||||||
date = DateTime.UtcNow;
|
date = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
return date.Value.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
return date.Value.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user