mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
return epoc milliseconds for revision date
This commit is contained in:
parent
174ac313ea
commit
1bef3a1e5b
@ -170,10 +170,17 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("revision-date")]
|
||||
public async Task<DateTime?> GetAccountRevisionDate()
|
||||
public async Task<long?> GetAccountRevisionDate()
|
||||
{
|
||||
var userId = _userService.GetProperUserId(User);
|
||||
return userId.HasValue ? (await _userService.GetAccountRevisionDateByIdAsync(userId.Value)) : (DateTime?)null;
|
||||
long? revisionDate = null;
|
||||
if(userId.HasValue)
|
||||
{
|
||||
var date = await _userService.GetAccountRevisionDateByIdAsync(userId.Value);
|
||||
revisionDate = Core.Utilities.CoreHelpers.EpocMilliseconds(date);
|
||||
}
|
||||
|
||||
return revisionDate;
|
||||
}
|
||||
|
||||
[HttpGet("two-factor")]
|
||||
|
@ -7,6 +7,7 @@ namespace Bit.Core.Utilities
|
||||
public static class CoreHelpers
|
||||
{
|
||||
private static readonly long _baseDateTicks = new DateTime(1900, 1, 1).Ticks;
|
||||
private static readonly DateTime _epoc = new DateTime(1970, 1, 1);
|
||||
|
||||
/// <summary>
|
||||
/// Generate sequential Guid for Sql Server.
|
||||
@ -57,5 +58,10 @@ namespace Bit.Core.Utilities
|
||||
certStore.Close();
|
||||
return cert;
|
||||
}
|
||||
|
||||
public static long EpocMilliseconds(DateTime date)
|
||||
{
|
||||
return (long)Math.Round((date - _epoc).TotalMilliseconds, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user