首页 > 代码库 > 时间线

时间线

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%"

时间线