I save a Date()
in the AsyncStorage
and when I open the app want to compare it to the current Date and check if at least n
minutes are passed. I found a similar topic on the forum and tried to follow it
I wrote something like
try {
const lastDate = await AsyncStorage.getItem('lastDate')
if (lastDate !== null) {
const currentDate = new Date()
console.log(currentDate.getTime() - lastDate.getTime())
}
But, I am getting an error telling me that getTime()
is undefined
.