I am console.log() this:
console.log(value['startDate']);
and getting this:
I want to convert it in my jQuery method so I can input that value here:
I am quite new with jQuery and JavaScript in general so any help will be appreciated.
I am console.log() this:
console.log(value['startDate']);
and getting this:
I want to convert it in my jQuery method so I can input that value here:
I am quite new with jQuery and JavaScript in general so any help will be appreciated.
The <input type="date">
has a property called valueAsNumber
to which you can assign a timestamp like the one in your object.
The input will then do the heavy lifting for you and set the corresponding date.
const input = document.querySelector('input');
const value = {
startDate: {
offset: 0,
timestamp: 1604966400,
timezone: {}
}
};
// This is where the magic happens.
input.valueAsNumber = value.startDate.timestamp;
<input type="date">