How to show a conditional element based on membership creation date? 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
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")
}
}
})
It works for me too! Thanks for the help 🙌
Please sign in to leave a comment.