I have a simple code not working with dates:
let today=Date(); let category = $w("#dropdown1").value; let counter = 0;
wixData.query("Members") .eq("membercategory", category) .ge("expirationdate", today) .count() .then((number) => { counter = number; $w("#text50").text = counter.toString(); if (counter >19){ $w("#html1").hide() $w("#button10").disable(); } });
expirationdate is in Date Time format, but it seems today (Date()) is in string:
How can I make it to Date and Time to compare with expirationdate field?
Thanks!
Imre
Change;
let today=Date();
into;
let today=new Date();
Thx man, for a quick test it seems working!!!
At night I can make a deep test as well!
Thx again!
I am trying so many variations but nothing works.
Do you have any idea?
Without this function I can not use my site :(
Thx!
Imre
Hi,
Of course, the main url is:
www.wedmet.net
The page I have this code on it is a dynamic page (Members ID).
Is enough info to help?
Thx,
Imre
Hi,
Your code looks ok.
Can you please share a link to your site and specify the name of the page so we can inspect?
Roi.