Gets the most recent year the list (to push forward a year)

 a Date = new new year the let () the getFullYear ();.
 var PrefixZero = (NUM, n-) => {
      return (the Array (n-) .join (0) + NUM) .slice (-n);
    }
 // Get Month  
. = month The new new the let a Date () The getMonth ()
// Get difference is determined whether the previous year
let i = month - 12; 
 // array of splicing
the let Array.apply = Array (null, the Array new new (12 is)) Map ((Item, index) => {.
    Return value {:? Index> = month The String (year + I) + PrefixZero ((index +1), 2): String ( year) + PrefixZero ((index + 1), 2), label: index> = month `$ {year + i} in $ {index + 1}` month:? `$ { in year} $ {index + 1}} `January;
  });
  });
// do the sorting
Array.sort ((A, B) => Number The (a.value) -Number (b.value))

Array i.e. to ask 

Guess you like

Origin www.cnblogs.com/zhouyx/p/12073654.html