Hello! I am trying to use the Corvid scheduler for a very simple feature, and it doesn’t seem to be working correctly at all. Wondering if I could get some help here.
Feature: change the date in the footer every day at noon “Site last updated: May 4, 2019”
Here is the code to the scheduler (in jobs.config):
{
"jobs": [
{
"functionLocation": "backend/mls.updateTime",
"description": "Update Time of site",
"executionConfig": {
"time": "12:00", // mandatory, “hh:mm” format
}
},
]
}
The function mls.updateTime is right here:
export function updateTime() {
const date = new Date();
let toInsert = {
"siteUpdate": date,
"_id": "fa8963a3-9183-4fad-a7fb-7e21e0882c8d",
}
wixData.update("GlobalVars", toInsert)
.then((results) => {
let item = results; //see item below
})
.catch((err) => {
let errorMsg = err;
});
}
Here is the directory setup (that way you know I’m doing this correctly. And the _id for the data is so I’m always pulling the correct date and inserting the correct date in a SINGLE row - not creating new ones.
So every 24 hrs, the date in the live database GlobalVars (the _id corresponds to the live database by the way, I’ve already made sure it’s not corresponding to the sandbox) should be updated. Now in “Site Code” section of the site, we are inserting that date into the footer like so: this is within the $w.onReady() function by the way, and #updated is the text in the footer that should contain the date. Nothing is working
wixData.get("GlobalVars", "fa8963a3-9183-4fad-a7fb-7e21e0882c8d")
.then((results) => {
let item = results; //see item below
console.log(item)
$w("#updated").text = item.siteUpate.toLocaleDateString()
})
.catch((err) => {
let errorMsg = err;
});