Displaying an element based on a condition Answered

I am trying to display an element 7 days after a user has registered. For that I wrote this code but it does not seem to work. Does anyone know how to solve this? Thanks in advance!

This is for memberstak 2.0
 
 

Comments

2 comments

  • Comment author
    Nemanja Vasilevski

    Can you check this code, this one works for me

    window.$memberstackDom.getCurrentMember().then((member) => {
    if (member.data) {
    console.log(member.data)
    const subscriptionDate = member.data.createdAt;
    const sevenDaysAgo = new Date(Date.now() - 7 _ 24 _ 60 _ 60 _ 1000)
    if(new Date(subscriptionDate) < sevenDaysAgo){
    alert("true")
    }else {
    alert("false")
    }
    }
    })
    0
  • It works for me too! Thanks for the help 🙌

    0

Please sign in to leave a comment.