Browse Source

添加时间工具类

lulihong 6 years ago
parent
commit
c428b3bdae
1 changed files with 24 additions and 1 deletions
  1. 24 1
      js/util.js

+ 24 - 1
js/util.js

@ -273,6 +273,30 @@ function getLastHalfMonthArray(dateStr){//格式:2018-07
    halfDate = data.getFullYear()+"-"+month+"-01"
    return halfDate;
}
//获取当前时间往前推3个季度
function getThirdJiDate(){
	debugger
	var startMonth =  getQuarterStartMonth()+1;//本季度开端月份
	var endMonth = getQuarterStartMonth() + 3;//本季度停止月份
	var curMonth = new Date().getMonth()+1;//当前月份
	var nowDate = new Date();
	var resDate;
	if(curMonth==startMonth){//往前推9个月
		nowDate.setMonth(nowDate.getMonth() - 9);
		resDate = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDay);
	}else if(curMonth>startMonth && curMonth<endMonth){//往前推10个月
		resDate = new Date(nowDate.getFullYear(), curMonth, nowDay);
		nowDate.setMonth(nowDate.getMonth() - 10);
	}else{//往前推11个月
		nowDate.setMonth(nowDate.getMonth() - 11);
		resDate = new Date(nowDate.getFullYear(), nowDate.getMonth()-2, nowDay);
	}
	return formatDate(resDate);
}
Date.prototype.Format = function (fmt) { //author: meizz 
	var o = {
	  "M+": this.getMonth() + 1, //月份 
@ -291,7 +315,6 @@ Date.prototype.Format = function (fmt) { //author: meizz
  }
function updateFontSize(){
	var width = document.body.clientWidth
	debugger
	console.log(width)
	if(width >= 1920) {
		$('html').css('font-size', width/10 + 'px')