Hello, I am finishing a custom security condition and what I am working on is contingent upon checking a date in the data source against today’s date. Moment.js does not work in this context:
var date = moment().format(‘YYYY-MM-DD’);
This is what I am looking to do: `
//get today's date
var todaysDate = moment().format("DD-MM-YYYY");
//get subscription date from data source
var subscriptionEndDate = session.entries.dataSource.data['Subscription End Date'];
//compare date subscriptionDate greater than todaysDate
var subscriptionIsValid = subscriptionEndDate > todaysDate;
if (server && page.id == mainMenu && subscriptionDateIsValid) {
navigate = { action: 'screen', page: login, transition: 'slide.left' };
}
I am focused on getting the todaysDate, I can work out the rest, just putting it here for reference.
Thank you in advance.