Here is the relevant code
From the date display on the header:
Quote:
<?php
$day = date('d'); //today
$month2 = date('m') + 1;
$year2 = date('y');
$date1 = '7-31-2009';
$month1 = '7';
$year1 = '09';
$month_diff = (($year2 - $year1) * 12) + ($month2 - $month1);
$canonyears_diff = $month_diff * 6;
$base_year = -2;
if($day >= 0 && day < 6) {
$extra_year = $base_year;
}
else if($day >= 6 && $day < 11) {
$extra_year = $base_year + 1;
}
else if($day >= 11 && $day < 16) {
$extra_year = $base_year + 2;
}
else if($day >= 16 && $day < 21) {
$extra_year = $base_year + 3;
}
else if($day >= 21 && $day < 26) {
$extra_year = $base_year + 4;
}
else if($day >= 26) {
$extra_year = $base_year + 5;
}
$current_year = $canonyears_diff + $extra_year;
?>
From the Calendar converter page (the accurate version):
Quote:
$( ".target" ).change(function() {
//var value = this.value; // omit "var" to make it global
//var date1 = '07/31/2009';
//$(".target").text(value);
//alert( value );
});
$('#calendar').datepicker({
minDate: '2015-11-26', //Start date, before this the dates get all messed up
dateFormat: 'yy-m-d',
inline: true,
onSelect: function(dateText, inst) {
var date = $(this).datepicker('getDate'),
day = date.getDate(),
month2 = date.getMonth() + 1,
year2 = date.getFullYear();
var date1 = '7-31-2009';
var month1 = '7';
var year1 = '2009';
month_diff = ((year2 - year1) * 12) + (month2 - month1);
canonyears_diff = month_diff * 6;
base_year = -2;
if (day >= 0 && day < 6) {
extra_year = base_year;
} else if (day >= 6 && day < 11) {
extra_year = base_year +1;
} else if (day >= 11 && day < 16) {
extra_year = base_year +2;
} else if (day >= 16 && day < 21) {
extra_year = base_year +3;
} else if (day >= 21 && day < 26) {
extra_year = base_year +4;
} else if (day >=26) {
extra_year = base_year +5;
}
current_year = canonyears_diff + extra_year;
$('#datepicker2').val(current_year + ' AI');
}
});
Remember, the one from the popup calendar is written in JS and the one for the header is written in PHP. That is how it has to be as PHPBB is weird. But obviously the logic should be the same, just different syntax.