Timestamp problem

Hi there! I'm using Timestamp from the time-utilities (latest) to convert a duration in milliseconds to a timestamp like this:
const timestamp = new Timestamp('HH:mm:ss');
const formattedTime = timestamp.display(status.currentTrack.duration);
const timestamp = new Timestamp('HH:mm:ss');
const formattedTime = timestamp.display(status.currentTrack.duration);
However the timestamp returned is always exactly 1 hour more than the actual duration, why could be that? eg: the duration 255085 should be 4 minutes 15 seconds, but the timestamp returned is 01:04:15 Tried to log a sample duration of 100 minutes and that also returned 02:40:00..
2 Replies
kyra
kyra•6d ago
Timezone, you need to compensate for it, I think Date.UTC(status.currentTrack.duration) will do the trick
Farleena (Dani)
Farleena (Dani)OP•6d ago
hm.. now it just shows 01:00:00 😄 for a duration of 222275 (3:42) isn't the problem to begin with that I pass in a duration of milliseconds instead of a Date object..?

Did you find this page helpful?