site: cosworthvega.com
page: locate-update-member
I have a custom membership database and need to run a report for members that have expired withing the last 90 days in order to send them a reminder.
Here is the code block:
let Today = new Date(); // Current Date
let numberOfDays = 365;
let expDate = Today.subtract(‘month’,3)
let displayDate = String(expDate);
console.log("Using date for Expired query: ", displayDate)
// EXPIRED RUN…
$w(wixData.filter()
.contains(‘mem_status’, $w(‘#statusValue’).value)
.eq(‘region’, $w(‘#regionValue’).value)
.gt(‘Expiry’, expDate)
);
}
GETTING RUNTIME ERROR IN JAVA CONSOLE:
TypeError: Today.subtract is not a function
I got this from a Google search on using dates in javascript.