expired-hours
v1.0.5
Published
this module allows you to write the time you want it to expire
Downloads
1
Readme
Expired Hours
this module allows you to write the time you want it to expire
import module
const {time} = require("expired-hours")
how use this
const {time} = require("expired-hours")
let hour_expired = time(3) //this add how many hours expired and return hour and date expired
console.log(hour_expired) //{ hV: '3:20 AM', dV: '08/27/2020' }
Can also be used to terminate sessions in React js or front-end
const {timeExpired,expired} = require("expired-hours") //import in constant
let hour_expired = timeExpired(3) //this add how many hours expired and return hour and date expired in json Stringify for save in localStorage
localStorage.setItem('mydata',hour_expired)//SAVE in local starage for finish session
//and to end the session
if (expired(localStorage.getItem("token"))){
//expired session and redirect LOGIN
}else{
//active session
}