view client/src/application/lib/session.js @ 585:ef307bd6b5d8

refac: restructured client application To make the application more accessible for developers, the structure was reorganized. Instead of sticking to technical terminology, the application terminology is according to the domain: I.e. "map" contains everything regarding map (including store).
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 07 Sep 2018 11:13:56 +0200
parents
children ca628dce90dd
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 };