view client/src/lib/session.js @ 527:4a637b333417

The CoreOS guys moved bbolt from github.com/coreos/ to github.com/etcd-io/.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 28 Aug 2018 08:07:08 +0200
parents 27502291e564
children
line wrap: on
line source

/**
 * Compares whether session is current
 * based on the expiry information and the
 * current date
 *
 * @param  {number} expiresFromPastSession
 */
function sessionStillActive(expiresFromPastSession) {
  if (!expiresFromPastSession) return false;
  const now = Date.now();
  const stillActive = now < expiresFromPastSession;
  return stillActive;
}
/**
 * Converts a given unix time to Milliseconds
 *
 * @param  {string} timestring
 */
function toMillisFromString(timestring) {
  return timestring * 1000;
}

export { sessionStillActive, toMillisFromString };