// ::xum::.org - getWeek() //------------------------------------- // numero de la semaine pour un objet Date Date.prototype.getWeek = function(){ var a = this.getFullYear(), m = this.getMonth()+1, j = this.getDate(); var S = Math.floor(a/100), A = a%100; var aB = (a%4==0 && a%100!=0) || (a%1000==0) ? 1: 0; var jNA = (5*S + Math.floor(S/4) + A + Math.floor(A/4) + aB*6)%7; var w = Math.floor((jNA+(m==1 ? j: m==2 ? 31+j: Math.floor((30.6*m)-32.3)+j+aB*1)+5)/7)-Math.floor(jNA/5); return (w==0 || w==53 ? 1: w); }