view client/src/application/lib/session.js @ 860:38b682eaa7b1

client: add updateing of bottleneck filter * Add a watcher on the selectedMorph to trigger the update of the bottleneck filter. * Reverse the parameter to updateBottleneckFilter() to the order that was mostly used.
author Bernhard Reiter <bernhard@intevation.de>
date Fri, 28 Sep 2018 17:19:08 +0200
parents ef307bd6b5d8
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 };