w-picker.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. const forMatNum=(num)=>{
  2. return num<10?'0'+num:num+'';
  3. }
  4. const initPicker={
  5. //日期
  6. date:{
  7. init(start,end,mode="date",step,value,flag,disabled,hasSecond){
  8. let aToday=new Date();
  9. let tYear,tMonth,tDay,tHours,tMinutes,tSeconds,defaultVal=[];
  10. let initstartDate=new Date(start.toString());
  11. let endDate=new Date(end.toString());
  12. if(start>end){
  13. initstartDate=new Date(end.toString());
  14. endDate=new Date(start.toString());
  15. };
  16. let startYear=initstartDate.getFullYear();
  17. let startMonth=initstartDate.getMonth()+1;
  18. let endYear=endDate.getFullYear();
  19. let years=[],months=[],days=[],hours=[],minutes=[],seconds=[],areas=[],returnArr=[],dvalDate=[];
  20. switch(mode){
  21. case "half":
  22. dvalDate=flag?[...value.split(" ")[0].split("-"),...value.split(" ")[1].split(":")]:[...value.split(" ")[0].split("-"),value.split(" ")[1]];
  23. break;
  24. case "date":
  25. case "yearMonth":
  26. dvalDate=value.split("-");
  27. break;
  28. case "dateTime":
  29. dvalDate=[...value.split(" ")[0].split("-"),...value.split(" ")[1].split(":")];
  30. break;
  31. case "time":
  32. dvalDate=value.split(":");
  33. break;
  34. }
  35. let curMonth=flag?dvalDate[1]*1:(dvalDate[1]+1);
  36. let dYear=aToday.getFullYear();
  37. let dMonth=aToday.getMonth()+1;
  38. let dDate=aToday.getDate();
  39. let totalDays=new Date(startYear,curMonth,0).getDate();
  40. let dvalObj={};
  41. switch(mode){
  42. case "half":
  43. case "date":
  44. case "yearMonth":
  45. let curYear=dvalDate[0];
  46. let curMonth=dvalDate[1];
  47. if(disabled){
  48. for(let s=startYear;s<=dYear;s++){
  49. years.push(s+'');
  50. };
  51. if(curYear==dYear){
  52. for(let m=1;m<=dMonth;m++){
  53. months.push(forMatNum(m));
  54. };
  55. }else{
  56. for(let m=1;m<=12;m++){
  57. months.push(forMatNum(m));
  58. };
  59. }
  60. if(curMonth==dMonth){
  61. for(let d=1;d<=dDate;d++){
  62. days.push(forMatNum(d));
  63. }
  64. }else{
  65. for(let d=1;d<=totalDays;d++){
  66. days.push(forMatNum(d));
  67. }
  68. }
  69. }else{
  70. for(let s=startYear;s<=endYear;s++){
  71. years.push(s+'');
  72. };
  73. for(let m=1;m<=12;m++){
  74. months.push(forMatNum(m));
  75. };
  76. for(let d=1;d<=totalDays;d++){
  77. days.push(forMatNum(d));
  78. }
  79. };
  80. break;
  81. default:
  82. for(let s=startYear;s<=endYear;s++){
  83. years.push(s+'');
  84. };
  85. for(let m=1;m<=12;m++){
  86. months.push(forMatNum(m));
  87. };
  88. for(let d=1;d<=totalDays;d++){
  89. days.push(forMatNum(d));
  90. }
  91. break;
  92. }
  93. for(let h=0;h<24;h++){
  94. hours.push(forMatNum(h));
  95. }
  96. for(let m=0;m<60;m+=step*1){
  97. minutes.push(forMatNum(m));
  98. }
  99. for(let s=0;s<60;s++){
  100. seconds.push(forMatNum(s));
  101. }
  102. if(flag){
  103. returnArr=[
  104. years.indexOf(dvalDate[0]),
  105. months.indexOf(dvalDate[1]),
  106. days.indexOf(dvalDate[2]),
  107. hours.indexOf(dvalDate[3]),
  108. minutes.indexOf(dvalDate[4])==-1?0:minutes.indexOf(dvalDate[4]),
  109. seconds.indexOf(dvalDate[5])
  110. ]
  111. }
  112. switch(mode){
  113. case "date":
  114. if(flag){
  115. defaultVal=[returnArr[0],returnArr[1],returnArr[2]];
  116. return {years,months,days,defaultVal}
  117. }else{
  118. defaultVal=[
  119. years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
  120. months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
  121. days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2])
  122. ];
  123. return {years,months,days,defaultVal}
  124. }
  125. break;
  126. case "half":
  127. areas=[{
  128. label:"上午",
  129. value:0
  130. },{
  131. label:"下午",
  132. value:1
  133. }];
  134. if(flag){
  135. defaultVal=[returnArr[0],returnArr[1],returnArr[2],returnArr[3]];
  136. return {years,months,days,areas,defaultVal}
  137. }else{
  138. let idx=0;
  139. areas.map((v,k)=>{
  140. if(v.label==dvalDate[3]){
  141. idx=v.value;
  142. }
  143. })
  144. defaultVal=[
  145. years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
  146. months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
  147. days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2]),
  148. idx
  149. ];
  150. return {years,months,days,areas,defaultVal}
  151. }
  152. break;
  153. case "yearMonth":
  154. if(flag){
  155. defaultVal=[returnArr[0],returnArr[1]];
  156. return {years,months,defaultVal}
  157. }else{
  158. defaultVal=[
  159. years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
  160. months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1])
  161. ];
  162. return {years,months,defaultVal}
  163. }
  164. break;
  165. case "dateTime":
  166. if(flag){
  167. defaultVal=returnArr;
  168. }else{
  169. if(hasSecond){
  170. defaultVal=[
  171. years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
  172. months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
  173. days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2]),
  174. hours.indexOf(dvalDate[3])==-1?0:hours.indexOf(dvalDate[3]),
  175. minutes.indexOf(dvalDate[4])==-1?0:minutes.indexOf(dvalDate[4]),
  176. seconds.indexOf(dvalDate[5])==-1?0:seconds.indexOf(dvalDate[5])
  177. ];
  178. }else{
  179. defaultVal=[
  180. years.indexOf(dvalDate[0])==-1?0:years.indexOf(dvalDate[0]),
  181. months.indexOf(dvalDate[1])==-1?0:months.indexOf(dvalDate[1]),
  182. days.indexOf(dvalDate[2])==-1?0:days.indexOf(dvalDate[2]),
  183. hours.indexOf(dvalDate[3])==-1?0:hours.indexOf(dvalDate[3]),
  184. minutes.indexOf(dvalDate[4])==-1?0:minutes.indexOf(dvalDate[4])
  185. ];
  186. }
  187. }
  188. if(hasSecond){
  189. return {years,months,days,hours,minutes,seconds,defaultVal}
  190. }else{
  191. return {years,months,days,hours,minutes,defaultVal}
  192. }
  193. break;
  194. case "time":
  195. if(flag){
  196. defaultVal=[returnArr[3],returnArr[4],returnArr[5]];
  197. }else{
  198. if(hasSecond){
  199. defaultVal=[
  200. hours.indexOf(dvalDate[0])==-1?0:hours.indexOf(dvalDate[0]),
  201. minutes.indexOf(dvalDate[1])==-1?0:minutes.indexOf(dvalDate[1]),
  202. seconds.indexOf(dvalDate[2])==-1?0:seconds.indexOf(dvalDate[2])
  203. ];
  204. }else{
  205. defaultVal=[
  206. hours.indexOf(dvalDate[0])==-1?0:hours.indexOf(dvalDate[0]),
  207. minutes.indexOf(dvalDate[1])==-1?0:minutes.indexOf(dvalDate[1])
  208. ];
  209. }
  210. }
  211. return {hours,minutes,seconds,defaultVal}
  212. break;
  213. }
  214. },
  215. initMonths:(year,disabled)=>{
  216. let aDate=new Date();
  217. let dYear=aDate.getFullYear();
  218. let dMonth=aDate.getMonth()+1;
  219. let dDate=aDate.getDate();
  220. let flag=dYear==year?true:false;
  221. let months=[];
  222. if(disabled){
  223. if(flag){
  224. for(let m=1;m<=dMonth;m++){
  225. months.push(forMatNum(m));
  226. };
  227. }else{
  228. for(let m=1;m<=12;m++){
  229. months.push(forMatNum(m));
  230. };
  231. }
  232. }else{
  233. for(let m=1;m<=12;m++){
  234. months.push(forMatNum(m));
  235. };
  236. };
  237. return months;
  238. },
  239. initDays:(year,month,disabled)=>{
  240. let aDate=new Date();
  241. let dYear=aDate.getFullYear();
  242. let dMonth=aDate.getMonth()+1;
  243. let dDate=aDate.getDate();
  244. let flag=(dYear==year&&dMonth==month)?true:false;
  245. let totalDays=new Date(year,month,0).getDate();
  246. let dates=[];
  247. if(flag&&disabled){
  248. for(let d=1;d<=dDate;d++){
  249. dates.push(forMatNum(d));
  250. };
  251. }else{
  252. for(let d=1;d<=totalDays;d++){
  253. dates.push(forMatNum(d));
  254. };
  255. };
  256. return dates;
  257. },
  258. },
  259. //短期日期上下午
  260. limitHour:{
  261. init(dayStep=7,dVal){
  262. let startDate=new Date();
  263. let date=[],areas=[],hours=[];
  264. let hour=new Date().getHours();
  265. let weeks=["周日","周一","周二","周三","周四","周五","周六"];
  266. let arrs=[];
  267. let defaultVal=[];
  268. let d=0,a=0,h=0;
  269. for(let i=0;i<dayStep;i++){
  270. let year,month,day,weekday;
  271. year=startDate.getFullYear();
  272. month=forMatNum(startDate.getMonth()+1);
  273. day=forMatNum(startDate.getDate());
  274. weekday=weeks[startDate.getDay()];
  275. let label="";
  276. switch(i){
  277. case 0:
  278. label="今天";
  279. break;
  280. case 1:
  281. label="明天"
  282. break;
  283. case 2:
  284. label="后天"
  285. break;
  286. default:
  287. label=month+"月"+day+"日"+" "+weekday;
  288. break;
  289. }
  290. date.push({
  291. label:label,
  292. value:year+"-"+month+"-"+day,
  293. today:i==0?true:false
  294. })
  295. startDate.setDate(startDate.getDate()+1);
  296. }
  297. if(hour>12){
  298. areas=[{
  299. label:"下午",
  300. value:1
  301. }]
  302. }else{
  303. areas=[{
  304. label:"上午",
  305. value:0
  306. },{
  307. label:"下午",
  308. value:1
  309. }]
  310. };
  311. for(let k=hour>12?hour-12:hour;k<=12;k++){
  312. hours.push({
  313. label:forMatNum(k),
  314. value:forMatNum(hour>12?k+12:k)
  315. })
  316. };
  317. date.map((v,k)=>{
  318. if(v.label==dVal[0]){
  319. d=k
  320. }
  321. })
  322. if(d!=0){
  323. areas=this.initAreas(date[d]);
  324. hours=this.initHours(date[d],areas[a]);
  325. }
  326. areas.map((v,k)=>{
  327. if(v.label==dVal[1]){
  328. a=k
  329. }
  330. })
  331. hours.map((v,k)=>{
  332. if(v.label==dVal[2]){
  333. h=k
  334. }
  335. });
  336. defaultVal=[d,a,h]
  337. return {date,areas,hours,defaultVal};
  338. },
  339. initAreas(date){
  340. let areas=[];
  341. let hour=new Date().getHours();
  342. if(date.today){
  343. if(hour>12){
  344. areas=[{
  345. label:"下午",
  346. value:1
  347. }]
  348. }else{
  349. areas=[{
  350. label:"上午",
  351. value:0
  352. },{
  353. label:"下午",
  354. value:1
  355. }]
  356. };
  357. }else{
  358. areas=[{
  359. label:"上午",
  360. value:0
  361. },{
  362. label:"下午",
  363. value:1
  364. }]
  365. }
  366. return areas;
  367. },
  368. initHours(dateCol,hourCol){
  369. let hours=[];
  370. let hour=new Date().getHours();
  371. if(dateCol.today){
  372. if(hourCol.value==1&&hour<=12){
  373. for(let k=1;k<=12;k++){
  374. hours.push({
  375. label:forMatNum(k),
  376. value:forMatNum(hourCol.value==1?k+12:k)
  377. })
  378. };
  379. }else{
  380. for(let k=hour>12?hour-12:hour;k<=12;k++){
  381. hours.push({
  382. label:forMatNum(k),
  383. value:forMatNum(hourCol.value==1?k+12:k)
  384. })
  385. };
  386. }
  387. }else{
  388. for(let k=1;k<=12;k++){
  389. hours.push({
  390. label:forMatNum(k),
  391. value:forMatNum(hourCol.value==1?k+12:k)
  392. })
  393. };
  394. };
  395. return hours
  396. }
  397. },
  398. //短期日期时间初始化
  399. limit:{
  400. init(dayStep=7,startHour=8,endHour=20,minuteStep=1,afterStep=30,dVal){
  401. let startDate=new Date();
  402. let bsDate=new Date(new Date().getTime()+afterStep*60*1000);
  403. let date=[],hours=[],minutes=[];
  404. let hour=bsDate.getHours();
  405. let minute=Math.floor(bsDate.getMinutes()/minuteStep)*minuteStep;
  406. let weeks=["周日","周一","周二","周三","周四","周五","周六"];
  407. let d=0,h=0,m=0;
  408. let defaultVal=[];
  409. for(let i=0;i<dayStep;i++){
  410. let year,month,day,weekday;
  411. year=startDate.getFullYear();
  412. month=forMatNum(startDate.getMonth()+1);
  413. day=forMatNum(startDate.getDate());
  414. weekday=weeks[startDate.getDay()];
  415. let label="";
  416. switch(i){
  417. case 0:
  418. label="今天";
  419. break;
  420. case 1:
  421. label="明天"
  422. break;
  423. case 2:
  424. label="后天"
  425. break;
  426. default:
  427. label=month+"月"+day+"日"+" "+weekday;
  428. break;
  429. }
  430. date.push({
  431. label:label,
  432. value:year+"-"+month+"-"+day,
  433. flag:i==0?true:false
  434. })
  435. startDate.setDate(startDate.getDate()+1);
  436. }
  437. if(hour<startHour){
  438. hour=startHour;
  439. };
  440. if(hour>endHour){
  441. hour=endHour;
  442. };
  443. for(let k=hour*1;k<=endHour*1;k++){
  444. hours.push({
  445. label:forMatNum(k),
  446. value:forMatNum(k),
  447. flag:k==hour?true:false
  448. })
  449. };
  450. for(let j=minute;j<60;j+=minuteStep*1){
  451. minutes.push({
  452. label:forMatNum(j),
  453. value:forMatNum(j)
  454. });
  455. }
  456. date.map((v,k)=>{
  457. if(v.label==dVal[0]){
  458. d=k
  459. }
  460. })
  461. if(d!=0){
  462. hours=this.initHours(startHour=8,endHour=20,minuteStep=1,afterStep=30,date[d].value);
  463. }
  464. hours.map((v,k)=>{
  465. if(v.label==dVal[1]){
  466. h=k
  467. }
  468. })
  469. minutes.map((v,k)=>{
  470. if(v.label==dVal[2]){
  471. m=k
  472. }
  473. })
  474. defaultVal=[d,h,m];
  475. return {date,hours,minutes,defaultVal};
  476. },
  477. initHours(startHour=8,endHour=20,minuteStep=1,afterStep=30,date){
  478. let hours=[];
  479. let arr=date.split("-");
  480. let aDate=new Date();
  481. let dYear=aDate.getFullYear();
  482. let dMonth=aDate.getMonth()+1;
  483. let dDate=aDate.getDate();
  484. let bsDate=new Date(new Date().getTime()+afterStep*60*1000);
  485. let hour=bsDate.getHours();
  486. let flag=(dYear==arr[0]&&dMonth==arr[1]&&dDate==arr[2])?true:false;
  487. if(hour>endHour){
  488. hour=endHour;
  489. };
  490. if(flag){
  491. for(let k=hour*1;k<=endHour*1;k++){
  492. hours.push({
  493. label:forMatNum(k),
  494. value:forMatNum(k),
  495. flag:k==hour?true:false
  496. })
  497. };
  498. }else{
  499. for(let k=startHour*1;k<=endHour*1;k++){
  500. hours.push({
  501. label:forMatNum(k),
  502. value:forMatNum(k),
  503. flag:false
  504. })
  505. }
  506. };
  507. return hours;
  508. },
  509. initMinutes(startHour=8,endHour=20,minuteStep=1,afterStep=30,date,hour){
  510. let minutes=[];
  511. let bsDate=new Date(new Date().getTime()+afterStep*60*1000);
  512. let arr=date.split("-");
  513. let aDate=new Date();
  514. let dYear=aDate.getFullYear();
  515. let dMonth=aDate.getMonth()+1;
  516. let dDate=aDate.getDate();
  517. let dHour=bsDate.getHours();;
  518. let minute=Math.floor(bsDate.getMinutes()/minuteStep)*minuteStep;
  519. let flag=(dYear==arr[0]&&dMonth==arr[1]&&dDate==arr[2])?true:false;
  520. if(flag){
  521. if(hour==dHour){
  522. for(let j=minute;j<60;j+=minuteStep*1){
  523. minutes.push({
  524. label:forMatNum(j),
  525. value:forMatNum(j)
  526. });
  527. }
  528. }else{
  529. for(let j=0;j<60;j+=minuteStep*1){
  530. minutes.push({
  531. label:forMatNum(j),
  532. value:forMatNum(j)
  533. })
  534. }
  535. }
  536. }else{
  537. for(let j=0;j<60;j+=minuteStep*1){
  538. minutes.push({
  539. label:forMatNum(j),
  540. value:forMatNum(j)
  541. })
  542. }
  543. }
  544. return minutes;
  545. }
  546. },
  547. //选择区间初始化
  548. range:{
  549. init(start,end,value,flag){
  550. let aToday=new Date();
  551. let tYear,tMonth,tDay,tHours,tMinutes,tSeconds,defaultVal=[];
  552. let initstartDate=new Date(start.toString());
  553. let endDate=new Date(end.toString());
  554. if(start>end){
  555. initstartDate=new Date(end.toString());
  556. endDate=new Date(start.toString());
  557. };
  558. let startYear=initstartDate.getFullYear();
  559. let startMonth=initstartDate.getMonth()+1;
  560. let endYear=endDate.getFullYear();
  561. let fyears=[],fmonths=[],fdays=[],tyears=[],tmonths=[],tdays=[],returnArr=[],startDVal=[],endDVal=[];
  562. startDVal=value[0].split("-");
  563. endDVal=value[1].split("-");
  564. let curMonth=flag?startDVal[1]*1:(startDVal[1]+1);
  565. let totalDays=new Date(startYear,curMonth,0).getDate();
  566. for(let s=startYear;s<=endYear;s++){
  567. fyears.push(s+'');
  568. };
  569. for(let m=1;m<=12;m++){
  570. fmonths.push(forMatNum(m));
  571. };
  572. for(let d=1;d<=totalDays;d++){
  573. fdays.push(forMatNum(d));
  574. };
  575. for(let s=startDVal[0];s<=endYear;s++){
  576. tyears.push(s+'');
  577. };
  578. if(endDVal[0]>startDVal[0]){
  579. for(let m=1;m<=12;m++){
  580. tmonths.push(forMatNum(m));
  581. };
  582. for(let d=1;d<=totalDays;d++){
  583. tdays.push(forMatNum(d));
  584. };
  585. }else{
  586. for(let m=startDVal[1];m<=12;m++){
  587. tmonths.push(forMatNum(m));
  588. };
  589. for(let d=startDVal[2];d<=totalDays;d++){
  590. tdays.push(forMatNum(d));
  591. };
  592. };
  593. defaultVal=[
  594. fyears.indexOf(startDVal[0])==-1?0:fyears.indexOf(startDVal[0]),
  595. fmonths.indexOf(startDVal[1])==-1?0:fmonths.indexOf(startDVal[1]),
  596. fdays.indexOf(startDVal[2])==-1?0:fdays.indexOf(startDVal[2]),
  597. 0,
  598. tyears.indexOf(endDVal[0])==-1?0:tyears.indexOf(endDVal[0]),
  599. tmonths.indexOf(endDVal[1])==-1?0:tmonths.indexOf(endDVal[1]),
  600. tdays.indexOf(endDVal[2])==-1?0:tdays.indexOf(endDVal[2])
  601. ];
  602. return {
  603. fyears,
  604. fmonths,
  605. fdays,
  606. tyears,
  607. tmonths,
  608. tdays,
  609. defaultVal
  610. }
  611. },
  612. initStartDays(year,month){
  613. let totalDays=new Date(year,month,0).getDate();
  614. let dates=[];
  615. for(let d=1;d<=totalDays;d++){
  616. dates.push(forMatNum(d));
  617. };
  618. return dates;
  619. },
  620. initEndYears(curYear,startYear,endYear){
  621. let years=[];
  622. for(let y=curYear;y<=endYear;y++){
  623. years.push(forMatNum(y));
  624. };
  625. return years;
  626. },
  627. initEndMonths(curMonth){
  628. let months=[];
  629. for(let m=curMonth*1;m<=12;m++){
  630. months.push(forMatNum(m));
  631. };
  632. return months;
  633. },
  634. initEndDays(curYear,curMonth,curDate,tYear,tMonth){
  635. let totalDays=new Date(curYear,curMonth,0).getDate();
  636. let days=[];
  637. for(let d=curDate*1;d<=totalDays;d++){
  638. days.push(forMatNum(d));
  639. };
  640. return days;
  641. },
  642. initToMonths(curYear,curMonth,curDate,tYear){
  643. let aDate=new Date(curYear,curMonth,curDate).getTime();
  644. let bDate=new Date(tYear,curMonth,curDate).getTime();
  645. let months=[];
  646. if(bDate-aDate>0){
  647. console.log(1)
  648. for(let m=1;m<=12;m++){
  649. months.push(forMatNum(m));
  650. };
  651. }else{
  652. for(let m=curMonth*1;m<=12;m++){
  653. months.push(forMatNum(m));
  654. };
  655. }
  656. return months;
  657. },
  658. initToDays(curYear,curMonth,curDate,tYear,tMonth){
  659. let aDate=new Date(curYear,curMonth,curDate).getTime();
  660. let bDate=new Date(tYear,tMonth,curDate).getTime();
  661. let totalDays=new Date(tYear,tMonth,0).getDate();
  662. let days=[];
  663. if(bDate-aDate>0){
  664. for(let d=1;d<=totalDays;d++){
  665. days.push(forMatNum(d));
  666. };
  667. }else{
  668. for(let d=curDate*1;d<=totalDays;d++){
  669. days.push(forMatNum(d));
  670. };
  671. }
  672. return days;
  673. }
  674. }
  675. }
  676. export default initPicker