function getTimeDiff(data, date = new Date()) {
let utc = new Date(Date.UTC(
data.year,
data.monthValue - 1,
data.dayOfMonth,
data.hour,
data.minute,
data.second
) - data.offset.totalSeconds*1e3);
return date - utc;
}
function msToTime(ms) {
let days = ms / 8.64e7 | 0;
let hrs = (ms%8.64e7) / 3.6e6 | 0;
let mins = (ms%3.6e6) / 6e4 | 0;
let secs = (ms%6e4) / 1e3 | 0;
let z = n => (n<10? '0':'') + n;
return `${days? days + ' day' + (days == 1? ' ' : 's ') : ''}${z(hrs)}:` +
`${z(mins)}:${z(secs)}`;
}
let callStartTime = {
chronology: {id: 'ISO', calendarType: 'iso8601'},
dayOfMonth: 8,
dayOfWeek: "TUESDAY",
dayOfYear: 39,
hour: 16,
minute: 15,
month: "FEBRUARY",
monthValue: 2,
nano: 240000000,
offset: {totalSeconds: 19800, id: '+05:30', rules: {}},
second: 29,