Help with function

Sorry, but I'm struggling with this function ....

const output = [null];

function sunData() {
    return suncalc.getSunTimes(new Date(), 43.690419, 10.816769);
}

const x = sunData.sunriseStart.value
output[0] = { payload: x };

return output;

the error is ...

"TypeError: Cannot read properties of undefined (reading 'value')"

Please help me ....

Because sunData is not called:

function sunData() {
    return suncalc.getSunTimes(new Date(), 43.690419, 10.816769);
}

const x = sunData().sunriseStart.value
return { payload: x };
1 Like

Thank you very much ......

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.