mirror of
https://github.com/bitwarden/server.git
synced 2025-02-17 02:01:53 +01: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)
|
||||
{
|
||||
var endSet = false;
|
||||
if(!end.HasValue)
|
||||
if(!end.HasValue || !start.HasValue)
|
||||
{
|
||||
endSet = true;
|
||||
end = DateTime.UtcNow.Date.AddDays(1).AddMilliseconds(-1);
|
||||
start = DateTime.UtcNow.Date.AddDays(-30);
|
||||
}
|
||||
|
||||
if(!start.HasValue)
|
||||
{
|
||||
start = end.Value.AddDays(-30);
|
||||
if(endSet)
|
||||
{
|
||||
start = start.Value.AddMilliseconds(1);
|
||||
}
|
||||
}
|
||||
|
||||
if(start.Value > end.Value)
|
||||
else if(start.Value > end.Value)
|
||||
{
|
||||
var newEnd = start;
|
||||
start = end;
|
||||
|
@ -417,7 +417,7 @@ namespace Bit.Core.Utilities
|
||||
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…
Reference in New Issue
Block a user