Anyone know how to get the session storage to work when the user input is a date picker?
Current code:
import { session } from ‘wix-storage’;
$w.onReady( function () {
$w(‘#input3’).value = session.getItem(“date”);
});
export function input3_change(event) {
var date = $w(‘#input3’).value
session.setItem(“date”, date);
}
Wix code SDK error: The value parameter that is passed to the value method cannot be set to the value Thu Jul 04 2019 00:00:00 GMT+0200 (sentraleuropeisk sommertid). It must be of type date.
The session storage contains a string - which is not a date. However, you can use the string to create a date object, which you can then use as the value of the date picker. Something like this:
$w('#input3').value = new Date(session.getItem("date"));