function gettimeLine(){
  const now = new Date();
  now.setHours( 0 );
  now.setMinutes( 0 );
  now.setSeconds( 1 );
  const year = now.getFullYear();
  const month = now.getMonth() + 1;
  const $year = now.getFullYear() - ( month < 4 ? 1 : 0 );
  const days = ( new Date( `${ $year + 1 }-04-01` ) - new Date( `${ $year }-04-01` ) ) / 86400000;
  return ( ( now - new Date( `${ $year }-04-01` ) ) / 86400000 / days * 100 ).toFixed( 2 ) + ‘%‘;
}
undefined
gettimeLine()
"30.32%"
原文:http://www.cnblogs.com/LSSSunshine/p/7219084.html