Date format of Collection not recognized

Im using a HTTP function to acquire some data from a collection. I update a field and push the updated JSON back using a PUT function.
I don’t edit the inherited date field/string (21-01-31T00:00:00.000Z) and push it straight back. This format is not recognized as a date in the collection. See image below.

What do i need to do to the date field/string to ensure it doesn’t corrupt the collection?

For the error: “The value does not match the field type Date”

See https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/data-api/working-with-the-data-api#date-fields

TL;DR it’s “YYYY-MM-DD” for dates, or iso8601 for datetimes.

There is an issue you’re encountering is due to how JavaScript’s toISOString() method works. The toISOString() method converts a Date object to a string in UTC time , which can result in a date that is one day behind (or ahead) depending on your local time zone.

You can try the below function

function formatDateToLocalISO(date) {
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are 0-based
    const day = String(date.getDate()).padStart(2, "0");
    return `${year}-${month}-${day}`;
}
const date = $w("#soloistBirthdateInput").value;
// Format the birthdate to YYYY-MM-DD (local date)
        const formattedDate = soloistBirthDate ? formatDateToLocalISO(date) : null;