Im trying to work on getting the Date value of Timestamp. I want to get the UTC equivalent value of the date since current working implementation uses my local Timezone. I found this very cool method that does it toUTCString()
Given the following line of code:
console.log("new Date(data[i].time).toUTCString()" , new Date(data[i].time).toUTCString());
console.log("new Date(data[i].time)" , new Date(data[i].time))
tempData.push(Object.assign({}, data[i], {'date': new Date(data[i].time).toUTCString()}));
Where console log returns the following and I get the converted result:
new Date(data[i].time).toUTCString() Wed, 06 Jun 2018 03:50:00 GMT
new Date(data[i].time) Wed Jun 06 2018 11:50:00 GMT+0800 (+08)
Gives me this error message:
Uncaught (in promise) TypeError: d.getTime is not a function
As further research, some SO answers point out the problem is because its a string value, but I think im using the right method to convert it to UTC.
Am I missing something here? Thanks!
I have a file autogenerated when I ran webpack, and this is the lines where I am directed base on the error.
var discontinuousIndexCalculator = (0, _utils.slidingWindow)().windowSize(2).undefinedValue(function (d, idx, di) {
    var i = di;
    var row = {
        date: d.getTime(),
        startOf30Seconds: false,
        startOfMinute: false,
        startOf5Minutes: false,
        startOf15Minutes: false,
        startOf30Minutes: false,
        startOfHour: false,
        startOfEighthOfADay: false,
        startOfQuarterDay: false,
        startOfHalfDay: false,
        startOfDay: true,
        startOfWeek: false,
        startOfMonth: false,
        startOfQuarter: false,
        startOfYear: false
    };
    var level = evaluateLevel(row, d, i);
    return _extends({}, row, { index: i }, level);
});
