JavaScript的Date对象有容错性,可将随意给定的日期的年月日自动生成正确的日期时间 //JavaScript中Date对象容错性 function dateCheck(){ var date = new Date(); date.setDate(date.getDate()+13); //date.setDate(date.getMonth()+1+10); //打印依然能输出正确的日期 console.log(date.getFullYear()+"年"+(date.get…
代码 Typescript版 /** * TimeSpan just like the class TimpSpan in C# ,represent the time difference * @class TimeSpan */ class TimeSpan { constructor(millionseconds: number) { this.totalMillionseconds = millionseconds; this.totalSeconds = millionseconds…