1
0
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:
Kyle Spearrin 2017-12-15 12:24:32 -05:00
parent a9f232746e
commit 79d46578b0
2 changed files with 4 additions and 15 deletions

View File

@ -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;

View File

@ -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");
} }
} }
} }