Javascript - Equivalent of .NET DateTime.MaxValue.Ticks

According to article "Azure Storage Table Design Guide: Designing Scalable and Performant Tables"
" https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-design-guide#log-tail-pattern". The below code is used to store the entities using a RowKey that naturally sorts in reverse date/time order by using so the most recent entry is always the first one in the table.

string invertedTicks = string.Format("{0:D19}", DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks);


The Equivalent JavaScript code is as below:

var currentTimeInMilliseconds=moment().add(-2, 'hours').valueOf() * 10000 + 621355968000000000;

//MaxTime is the DateTime.MaxValue.Ticks
var MaxTime = 3155378975999999999;

var rowKey =(MaxTime - currentTimeInMilliseconds).toString();


Comments

Popular posts from this blog

Top JavaScript courses helping you develop SPFx webPart with ReactJS and AngularJS

SharePoint 2013 error - "Application error when access /_vti_bin/client.svc"

Enable the Microsoft Power BI report file type (.pbix) in SharePoint Search