Hi,
I don’t understand your code.
Assuming that the button in a dynamic item page
The structure should be like this:
import wixData from 'wix-data';
$w.onReady(() => {
$w('#yourDataset').onReady(() => {
const currentItem = $w('#yourDataset').getCurrentItem():
if (currentItem.lastPressed > '24H') { // pseudo code... use Date method. read more on the link.
$w('#yourButton').enable();
} else {
$w('#yourButton').disable();
}
});
});
function buttonClick() {
const someDateFormat = new Date(); // pseudo code...
$w('#yourDataset').setFieldValue("lastPressed", someDateFormat);
}
Good luck!
Roi.