// API Reference: https://www.wix.com/corvid/reference
// “Hello, World!” Example: https://www.wix.com/corvid/hello-world
export function dynamicDataset_ready() {
let itemObj = $w(“#dynamicDataset”).getCurrentItem();
$w(“#text4”).text = itemObj.arrivalDate.toDateString();
}
export function input2_blur(event, $w) {
let $item = $w.at(event.context);
let date1 = new Date($item(“#input2”).value);
if (!$item(“#input2”).value) {
$w(‘#dynamicDataset’).setFieldValue(“date1”, “”)
} else {
$w(‘#dynamicDataset’).setFieldValue(“date1”, date1)
}
return $w(“#dynamicDataset”).save();
}
$w.onReady(function () {
// Write your JavaScript here
// Gets today’s date
const xDate = new Date();// Sets the property of the text element to be a string representing today’s date in the user’s local format
const xtime= xDate.toLocaleDateString() +”-” +xDate.getHours() + “:” + xDate.getMinutes();
$w(‘#input1’).value =xtime;
$w(‘#input2’).value =xtime;
// Click “Preview” to run your code
});
回答0