This project is archived and is in readonly mode.

#170 ✓resolved
Ess

Date.get('week') return incorrect value

Reported by Ess | October 29th, 2009 @ 09:44 PM | in 1.3.1.1

(sorry for my english)

For exemple :

new Date(2009,9,5).get('week');

return 40. The true value is 41.

You can fix it :

getWeek: function( monday_first ){
    var start = new Date( this.get('year'),0,1 );
    var day = start.get('day');
    // if Monday is first day of week
    if( monday_first && day == 0 ){ day = 7; };
    return Math.ceil( ( this.get('dayofyear') + day - 1 ) / 7 );
},

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The MooTools Extensions

People watching this ticket

Tags

Pages