Hey,
How can i capture the output of nodejs script? it shows as json but its a string and there is total 2 output i want to add capture for both separately
first date time is expiry and second date time is start date
{"result":["1/1/1970, 5:30:00 am","10/8/2020, 3:39:18 pm"]}
Image:
my script:
const data = JSON.parse(fullJson);
const targetProduct = "company name";
let expireTime = null;
let createTime = null;
for (const item of data.data.list) {
if (item.product_name === targetProduct) {
expireTime = item.expire_time;
createTime = item.create_time;
break;
}
}
function convertUnixToDate(unixTime) {
if (unixTime !== null) {
const date = new Date(unixTime * 1000);
return date.toLocaleString();
}
return "Not Found";
}
const result = [
convertUnixToDate(expireTime),
convertUnixToDate(createTime)
];