set date


im following this tutorial:

to display date time on my page, but it is not working, what i got:

 // Gets today's date
 const date = $w("#dataset1").getCurrentItem().date;

 const options = {
        day: "numeric",
        month: "short",
        year: "numeric"
    };
 // Sets the property of the text element to be a string representing today's date in US English
    $w("#text2").text = date.toLocaleDateString("en-US", options);


but my text2 field is not displaying the date

Hey,

That tutorial specifically says " Add a text element to your page but do not connect it to the dataset. Your code will do the work instead".

We do not recommend applying data binding and code to the same element.

Please remove the dataset connection from the text element and test your code again.

Hope this helps!

Dara | Corvid Team