JQuery fullCalendar 时间差 排序获取距当前最近的时间。

1             let time = (wo: WoDto) => wo.ScheduleTime || wo.ScheduleStartTime;
2 
3             let wo = technician.wos
4                 .filter(x => time(x) != null)
5                 .sort((a, b) =>
6                     Math.abs(moment().diff(moment(time(a)))) -
7                     Math.abs(moment().diff(moment(time(b))))
8             )[0];
9             this.$calendar.fullCalendar('gotoDate', wo ? moment(time(wo)) : moment());

原文地址:https://www.cnblogs.com/IT-Bear/p/5260887.html