MediaWiki:Gadget-resign-calculator.js: Difference between revisions

Default the first season to the current year
Default the first season to the upcoming season
Line 7: Line 7:
'use strict';
'use strict';


var CURRENT_YEAR = new Date().getFullYear(),
// The league numbers a season by the year it ends in, so the season being
// signed for is always the next one up from the current calendar year.
var UPCOMING_SEASON = new Date().getFullYear() + 1,
MAX = 11500000,
MAX = 11500000,
DISCOUNT = 1500000,
DISCOUNT = 1500000,
Line 129: Line 131:
season.type = 'number';
season.type = 'number';
season.step = '1';
season.step = '1';
season.placeholder = String( CURRENT_YEAR );
season.placeholder = String( UPCOMING_SEASON );
season.value = String( CURRENT_YEAR );
season.value = String( UPCOMING_SEASON );
seasonRow.appendChild( seasonLabel );
seasonRow.appendChild( seasonLabel );
seasonRow.appendChild( season );
seasonRow.appendChild( season );
Line 212: Line 214:
who = name.value.trim();
who = name.value.trim();
if ( isNaN( first ) ) {
if ( isNaN( first ) ) {
first = CURRENT_YEAR;
first = UPCOMING_SEASON;
}
}
var endYear = first + years - 1;
var endYear = first + years - 1;