view client/src/lib/session.js @ 165:4bf2173748f3

refactor: extracted the string to milisecondconversion Extracted the conversion of session data to string conversion to Method. SRP.
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 06 Jul 2018 11:04:52 +0200
parents 30c212a6f580
children 27502291e564
line wrap: on
line source

function sessionStillActive(expiresFromPastSession) {
  if (!expiresFromPastSession) return false;
  const now = Date.now();
  const stillActive = now < expiresFromPastSession;
  return stillActive;
}

function toMillisFromString(timestring) {
  return timestring * 1000;
}

export { sessionStillActive, toMillisFromString };