siam_hacker(at)hotmail.com [Kenny G.--Thailand]
1.if you want to use calendar with year in BE format (พ.ศ.)
2.open "calendar.js" file in "calendar" folder
2.1 find this code
Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
// member variables
this.activeDiv = null;
2.2 change it
Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
// Special Variable
this.YearStyle = false; // set year format as you want (false = AD(ค.ศ.),true = BE(พ.ศ.))
// member variables
this.activeDiv = null;
2.3 find this code
if (Y >= cal.minYear && Y <= cal.maxYear) {
yr.innerHTML = Y;
yr.year = Y;
2.4 change it
if (Y >= cal.minYear && Y <= cal.maxYear) {
//------------------------------------------------------------------------------------------------------//
if (!calendar.YearStyle) yr.innerHTML = Y; // Show year list in AD format, à¹à¸ªà¸”งรายà¸à¸²à¸£à¸›à¸µà¹ƒà¸™à¹à¸šà¸š ค.ศ.
if (calendar.YearStyle) yr.innerHTML = (Y+543); // Show year list in BE format, à¹à¸ªà¸”งรายà¸à¸²à¸£à¸›à¸µà¹ƒà¸™à¹à¸šà¸š พ.ศ.
//------------------------------------------------------------------------------------------------------//
yr.year = Y;
2.5 find this code
this.title.innerHTML = Calendar.MN[month] + ", " + year;
2.6 then change it
//------------------------------------------------------------------------------------------------------//
if (!this.YearStyle) this.title.innerHTML = Calendar.MN[month] + ", " + year; // à¹à¸ªà¸”งหัวปà¸à¸´à¸—ินในà¹à¸šà¸š ค.ศ.
if (this.YearStyle) this.title.innerHTML = Calendar._MN[month] + ", " + (year+543); // à¹à¸ªà¸”งหัวปà¸à¸´à¸—ินในà¹à¸šà¸š พ.ศ.
//------------------------------------------------------------------------------------------------------//
2.7 find this code
var y = this.getFullYear();
2.8 in "Date.prototype.print = function (str,a) { " function, then change it
//-------------------------------------------------------------------------------------------------------------------//
if (!calendar.YearStyle) var y = this.getFullYear(); // send year in AD format to InputField,ส่งวันที่ที่เลืà¸à¸à¹„ปยังช่à¸à¸‡à¸£à¸±à¸šà¸§à¸±à¸™à¸—ี่
if (calendar.YearStyle) var y = this.getFullYear()+543; // send year in BE format to InputField
//-------------------------------------------------------------------------------------------------------------------//
2.9 save it
- you can include it to template file and extension