因为写全局的公共方法没写容错处理额==,mark一下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 transferMinutesToTime(minutes,onlyToHour) { const basicMinute = 60 ; const basicHour = 24 ; const basic = basicHour*basicMinute; if (!this .checkByRegExp.nonnegativeInt(minutes)){ return null ; } if (minutes == 0 ) { return onlyToHour ? { day : 0 , hour : 0 } : { day : 0 , hour : 0 , minute : 0 } } let all = Number(minutes); let day = Math.floor (all/basic); let hour = Math.floor ((all%basic)/basicMinute); let minute = all%basic%basicMinute; let data = { day : day ?day :0 , hour : hour ?hour :0 } if (!onlyToHour){ data.minute = minute ?minute :0 ; } return data; }