forked from kbwood/calendars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.calendars.discworld.min.js
6 lines (6 loc) · 2.53 KB
/
jquery.calendars.discworld.min.js
1
2
3
4
5
6
/* http://keith-wood.name/calendars.html
Discworld calendar for jQuery v2.0.2.
Written by Keith Wood (wood.keith{at}optusnet.com.au) January 2016.
Available under the MIT (http://keith-wood.name/licence.html) license.
Please attribute the author if you use it. */
(function($){function DiscworldCalendar(a){this.local=this.regionalOptions[a||'']||this.regionalOptions['']}DiscworldCalendar.prototype=new $.calendars.baseCalendar;$.extend(DiscworldCalendar.prototype,{name:'Discworld',jdEpoch:1721425.5,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{'':{name:'Discworld',epochs:['BUC','UC'],monthNames:['Ick','Offle','February','March','April','May','June','Grune','August','Spune','Sektober','Ember','December'],monthNamesShort:['Ick','Off','Feb','Mar','Apr','May','Jun','Gru','Aug','Spu','Sek','Emb','Dec'],dayNames:['Sunday','Octeday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Oct','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Oc','Mo','Tu','We','Th','Fr','Sa'],digits:null,dateFormat:'yyyy/mm/dd',firstDay:2,isRTL:false}},leapYear:function(a){this._validate(a,this.minMonth,this.minDay,$.calendars.local.invalidYear);return false},monthsInYear:function(a){this._validate(a,this.minMonth,this.minDay,$.calendars.local.invalidYear);return 13},daysInYear:function(a){this._validate(a,this.minMonth,this.minDay,$.calendars.local.invalidYear);return 400},weekOfYear:function(a,b,c){var d=this.newDate(a,b,c);d.add(-d.dayOfWeek(),'d');return Math.floor((d.dayOfYear()-1)/8)+1},daysInMonth:function(a,b){var c=this._validate(a,b,this.minDay,$.calendars.local.invalidMonth);return this.daysPerMonth[c.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(a,b,c){var d=this._validate(a,b,c,$.calendars.local.invalidDate);return(d.day()+1)%8},weekDay:function(a,b,c){var d=this.dayOfWeek(a,b,c);return(d>=2&&d<=6)},extraInfo:function(a,b,c){var d=this._validate(a,b,c,$.calendars.local.invalidDate);return{century:e[Math.floor((d.year()-1)/100)+1]||''}},toJD:function(a,b,c){var d=this._validate(a,b,c,$.calendars.local.invalidDate);a=d.year()+(d.year()<0?1:0);b=d.month();c=d.day();return c+(b>1?16:0)+(b>2?(b-2)*32:0)+(a-1)*400+this.jdEpoch-1},fromJD:function(a){a=Math.floor(a+0.5)-Math.floor(this.jdEpoch)-1;var b=Math.floor(a/400)+1;a-=(b-1)*400;a+=(a>15?16:0);var c=Math.floor(a/32)+1;var d=a-(c-1)*32+1;return this.newDate(b<=0?b-1:b,c,d)}});var e={20:'Fruitbat',21:'Anchovy'};$.calendars.calendars.discworld=DiscworldCalendar})(jQuery);