The Mercurian Empire
http://hermertia.com/

New and improved calendar
http://hermertia.com/viewtopic.php?f=14&t=1008
Page 3 of 4

Author:  Petra Ravnikaar [ October 7th, 2016, 2:36 pm ]
Post subject:  Re: New and improved calendar

message siden directly with what you need help with incase he missed this post. excited to see what your long awaited character sheets will be like!

Author:  Cerdic Accynnafon [ November 1st, 2016, 7:39 pm ]
Post subject:  Re: New and improved calendar

It's off by two years as of Nov 1, and still off by an entire era.

Author:  Cerdic Accynnafon [ December 1st, 2016, 7:25 am ]
Post subject:  Re: New and improved calendar

It's off by years and now off by two entire eras. Update this Siden!

Author:  Cerdic Accynnafon [ January 6th, 2017, 7:43 pm ]
Post subject:  Re: New and improved calendar

Could this either be updated or removed?

Author:  Cerdic Accynnafon [ January 31st, 2017, 7:39 pm ]
Post subject:  Re: New and improved calendar

^^^^^^^^^^

Author:  King Tiber III [ January 31st, 2017, 9:02 pm ]
Post subject:  Re: New and improved calendar

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Author:  Johanssen [ January 31st, 2017, 11:49 pm ]
Post subject:  Re: New and improved calendar

Figuring it out, I'm gonna try and get it working soon.

Author:  Cerdic Accynnafon [ February 11th, 2017, 5:01 pm ]
Post subject:  Re: New and improved calendar

Appears it is goofed again. The calendar converter works correctly though!

Author:  Aren [ February 12th, 2017, 6:48 am ]
Post subject:  Re: New and improved calendar

Anyone can share with me what the current code looks like? I've got an accurate calendar written in java currently, could attempt to help

Author:  Johanssen [ February 12th, 2017, 7:08 am ]
Post subject:  Re: New and improved calendar

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.

Page 3 of 4 All times are UTC [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/