UNPKG

press-next

Version:

Vue3 组件库,支持 Composition API

14 lines (11 loc) 400 B
export function getCurBattleSeqFromTime(timeCfg: any[]) { const now = Math.floor(Date.now() / 1000); if (!timeCfg.length || !timeCfg[0]?.stime || timeCfg[0].stime > now) return 1; for (let i = 1;i < timeCfg.length;i++) { const item = timeCfg[i]; if (item.stime > now && timeCfg[i - 1].stime <= now) { return Math.min(i + 1, timeCfg.length); } } return timeCfg.length; }