Obtain the date range of the week according to the week
Obtain the date range of the week according to the week
/*** Return the range of Weekly Times of a month in a certain year * @ param weeks Weekly Times * @ return the range of dates of the week */function getXDate (year, weeks) {var date = new Date (year, "0", "1"); var time = date. getTime (); // get the current day of the week, 0: Monday .... Var _ week = date. getDay (); // if the first day of the year is Sunday, the current year has 54 weeks. Otherwise, if (_ week! = 0) {// 53 weeks of a year if (weeks = 54) {return 'no 54 weeks of this year';} var cnt = 0; // obtain the number of days from the weekend if (_ week = 0) {cnt = 7;} else if (_ week = 1) {cnt = 6 ;} else if (_ week = 2) {cnt = 5;} else if (_ week = 3) {cnt = 4;} else if (_ week = 4) {cnt = 3;} else if (_ week = 5) {cnt = 2;} else if (_ week = 6) {cnt = 1 ;} cnt + = 1; // Add 1 to indicate the first day of the week on Monday. // Add the long integer time to the time Offset of week N. time + = cnt * 24*3600000; // week 1 Start Time var nextYear = new Date (parseInt (year, 10) + 1, "0", "1"); var nextWeek = nextYear. getDay (); var lastcnt = 0; // obtain the number of days from the last week's start time to the weekend if (nextWeek = 0) {lastcnt = 6 ;} else if (nextWeek = 1) {lastcnt = 0;} else if (nextWeek = 2) {lastcnt = 1;} else if (nextWeek = 3) {lastcnt = 2;} else if (nextWeek = 4) {lastcnt = 3;} else if (nextWeek = 5) {lastcnt = 4 ;} else if (nextWeek = 6) {lastcnt = 5;} if (weeks = 1) {// special processing for week 1st // reset the date object to time var start = date. format ("MM dd, yyyy"); date. setTime (time-24*3600000); return start + '--' + date. format ("yyyy MM dd");} else if (weeks = 53) {// 53rd special weekly processing var start = time + (weeks-2) * 7*24*3600000; // the start time of week 53rd var end = time + (weeks-2) * 7*24*3600000 + lastcnt * 24*3600000-24*3600000; // end time of week 53rd // reset the date object to time date. setTime (start); var _ start = date. format ("MM dd, yyyy"); date. setTime (end); var _ end = date. format ("MM dd, yyyy"); return _ start + '--' + _ end;} else {var start = time + (weeks-2) * 7*24*3600000; // the nth week start time var end = time + (weeks-1) * 7*24*3600000-24*3600000; // end time of week n // reset the date object to time date. setTime (start); var _ start = date. format ("MM dd, yyyy"); date. setTime (end); var _ end = date. format ("MM dd, yyyy"); return _ start + '--' + _ end ;}} else {// var cnt = 0 for 54 weeks a year; // obtain the number of days from the weekend if (_ week = 0 & weeks = 1) {// The first week cnt = 0;} else if (_ week = 0) {cnt = 7;} else if (_ week = 1) {cnt = 6;} else if (_ week = 2) {cnt = 5 ;} else if (_ week = 3) {cnt = 4;} else if (_ week = 4) {cnt = 3;} else if (_ week = 5) {cnt = 2;} else if (_ week = 6) {cnt = 1;} cnt + = 1; // Add 1 to indicate the first day of a week on Monday. // Add the long integer time to the time offset of the nth week. time + = 24*3600000; // week 1 Start Time var nextYear = new Date (parseInt (year, 10) + 1, "0", "1"); var nextWeek = nextYear. getDay (); var lastcnt = 0; // obtain the number of days from the last week's start time to the weekend if (nextWeek = 0) {lastcnt = 6 ;} else if (nextWeek = 1) {lastcnt = 0;} else if (nextWeek = 2) {lastcnt = 1;} else if (nextWeek = 3) {lastcnt = 2;} else if (nextWeek = 4) {lastcnt = 3;} else if (nextWeek = 5) {lastcnt = 4 ;} else if (nextWeek = 6) {lastcnt = 5;} if (weeks = 1) {// special processing for week 1st // reset the date object to time var start = date. format ("MM dd, yyyy"); date. setTime (time-24*3600000); return start + '--' + date. format ("yyyy MM dd");} else if (weeks = 54) {// 54th special weekly processing var start = time + (weeks-2) * 7*24*3600000; // the start time of week 54th var end = time + (weeks-2) * 7*24*3600000 + lastcnt * 24*3600000-24*3600000; // end time of week 53rd // reset the date object to time date. setTime (start); var _ start = date. format ("MM dd, yyyy"); date. setTime (end); var _ end = date. format ("MM dd, yyyy"); return _ start + '--' + _ end;} else {var start = time + (weeks-2) * 7*24*3600000; // the nth week start time var end = time + (weeks-1) * 7*24*3600000-24*3600000; // end time of week n // reset the date object to time date. setTime (start); var _ start = date. format ("MM dd, yyyy"); date. setTime (end); var _ end = date. format ("MM dd, yyyy"); return _ start + '--' + _ end ;}}}
:
Jsp part: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vc3ryb25np1_vcd4kpha + PHByZSBjbGFzcz0 = "brush: java;"> $ {V} Block weekly click events without data:
Idea: it is actually very simple, just to control the style. First, set the weekly style as unclickable, and then add clickable style based on weekly recycling of data, click "practice" to determine blocking.
Example of a custom space: