我如何才能将此伪代码转换为有效的 JS [不要担心结束日期来自哪里,除非它是一个有效的 JavaScript 日期]。
var myEndDateTime = somedate; //somedate is a valid JS date
var durationInMinutes = 100; //this can be any number of minutes from 1-7200 (5 days)
//this is the calculation I don't know how to do
var myStartDate = somedate - durationInMinutes;
alert("The event will start on " + myStartDate.toDateString() + " at " + myStartDate.toTimeString());