Cesium.js:1 Uncaught TypeError: Cannot set properties of undefined (setting 'dayNumber')

Hi,
I am going to create a ground Vehicle Tracking by passing packet of data( [{ lon: 78.60834078421288, lat: 19.977258721643523, time: “2020-03-09T02:10:00Z” }] ) and while converting time format from “2020-03-09T02:10:00Z” to JulianDate format I’m getting an error like (Cesium.js:1 Uncaught TypeError: Cannot set properties of undefined (setting ‘dayNumber’)).
well, I have added bit of code here,

const routeData1 = [{lon: 78.60834078421288, lat: 19.977258721643523, time: "2020-03-09T02:10:00Z" }];

 function trackVehicle(vehicleid, waypoints) {

        const start = routepath[0].time;

        console.log('START ', start);

        const stop = Cesium.JulianDate.addSeconds(waypoints[0].time);  //ERROR LINE: Cannot set properties of undefined (setting 'dayNumber')

        console.log('STOP ', stop);

        //setting cesium clock

        map.clock.startTime = start.clone();

        map.clock.stopTime = stop.clone();

        map.clock.currentTime = start.clone();

        map.timeline.zoomTo(start, stop);

      }
}

document.getElementById("pack1").onclick = function () {

      trackVehicle('AA1012', routeData1);

    }; 

ERROR LOG :

Cesium.js:1 Uncaught TypeError: Cannot set properties of undefined (setting 'dayNumber')
    at setComponents (Cesium.js:1)
    at Function.JulianDate.addSeconds (Cesium.js:1)
    at trackVehicle (track.html:206)
    at HTMLButtonElement.document.getElementById.onclick (track.html:261)

This happened to me once with Cartesian3 when I forgot to put it in import at the top of my index.js file when I first used webpack. Also sometimes I forget to add a file to import from cesium when i’ve made a new change.
If your using webpack maybe its a similar thing where you need to import one of the clock functions? Just guessing here, that’s all I got. Good Luck :slight_smile:

1 Like

Thanks, Actually for each 5 second I push a new packet of data( [{ lon: 78.60834078421288, lat: 19.977258721643523, time: “2020-03-09T02:10:00Z” }], [{ lon: 78.70834078421288, lat: 19.877258721643523, time: “2020-03-09T02:10:05Z” }] ). For each packet d/m/y is same, and it can’t able to set the dayNumber, that’s why we are getting this Error : Uncaught TypeError: Cannot set properties of undefined (setting ‘dayNumber’) …???

1 Like