msal
Version:
Microsoft Authentication Library for js
32 lines • 1.05 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @hidden
*/
var TimeUtils = /** @class */ (function () {
function TimeUtils() {
}
/**
* Returns time in seconds for expiration based on string value passed in.
*
* @param expiresIn
*/
TimeUtils.parseExpiresIn = function (expiresIn) {
// if AAD did not send "expires_in" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as "expires_in" value instead of 3600
if (!expiresIn) {
expiresIn = "3599";
}
return parseInt(expiresIn, 10);
};
/**
* return the current time in Unix time. Date.getTime() returns in milliseconds.
*/
TimeUtils.now = function () {
return Math.round(new Date().getTime() / 1000.0);
};
return TimeUtils;
}());
exports.TimeUtils = TimeUtils;
//# sourceMappingURL=TimeUtils.js.map