首页 > 其他 > 详细

时间线

时间:2017-07-21 18:40:59      阅读:256      评论:0      收藏:0      [点我收藏+]

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!