I want to verify Date is valid for subscription.
Date is in UTC format.
when user creates an account i set the expiration date to be the date in 30 days.
Before each action, i want to verify the expiration date of his account.
To get the days left for user i do
let oneDay = 24*60*60*1000;
let daysLeft = (userSubscription.expired - new Date())/(oneDay))
Now i want to check that if daysLeft
is 0, then do some action alerting the user.
My problem is, that is if expiration was a year ago, then days left will not be below 0 as i expected, it will be 300+.
how can i enforce it?