const refreshTokenKey='sExpDate';
export function LoadSessionExpireDate() : Date | null{
    const item = localStorage.getItem(refreshTokenKey);
    return item == null ? null : new Date(item);
}

export function IsSessionActive() : boolean{
    const sessionExpDate = localStorage.getItem(refreshTokenKey);
    return sessionExpDate != null && new Date(sessionExpDate) > new Date();
}

export function SetSessionExpireDate(dateString: string | null | undefined){
    if (dateString == null){
        
        localStorage.removeItem(refreshTokenKey);
    }
    else{
        localStorage.setItem(refreshTokenKey, dateString);
    }
}