-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjdate.min.js
1 lines (1 loc) · 6.18 KB
/
jdate.min.js
1
function require(t){var e=require.modules[t];if(!e)throw new Error('failed to require "'+t+'"');return"exports"in e||"function"!=typeof e.definition||(e.client=e.component=!0,e.definition.call(this,e.exports={},e),delete e.definition),e.exports}require.modules={},require.register=function(t,e){require.modules[t]={definition:e}},require.define=function(t,e){require.modules[t]={exports:e}},require.register("component~props@1.1.2",function(t,e){function r(t){return t.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(o,"").match(/[$a-zA-Z_]\w*/g)||[]}function n(t,e,r){var n=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return t.replace(n,function(t){return"("==t[t.length-1]?r(t):~e.indexOf(t)?r(t):t})}function i(t){for(var e=[],r=0;r<t.length;r++)~e.indexOf(t[r])||e.push(t[r]);return e}function a(t){return function(e){return t+e}}var o=/\b(this|Array|Date|Object|Math|JSON)\b/g;e.exports=function(t,e){var o=i(r(t));return e&&"string"==typeof e&&(e=a(e)),e?n(t,o,e):o}}),require.register("component~to-function@2.0.5",function(t,e){function r(t){switch({}.toString.call(t)){case"[object Object]":return o(t);case"[object Function]":return t;case"[object String]":return a(t);case"[object RegExp]":return i(t);default:return n(t)}}function n(t){return function(e){return t===e}}function i(t){return function(e){return t.test(e)}}function a(t){return/^ *\W+/.test(t)?new Function("_","return _ "+t):new Function("_","return "+u(t))}function o(t){var e={};for(var i in t)e[i]="string"==typeof t[i]?n(t[i]):r(t[i]);return function(t){if("object"!=typeof t)return!1;for(var r in e){if(!(r in t))return!1;if(!e[r](t[r]))return!1}return!0}}function u(t){var e=s(t);if(!e.length)return"_."+t;var r,n,i;for(n=0;n<e.length;n++)i=e[n],r="_."+i,r="('function' == typeof "+r+" ? "+r+"() : "+r+")",t=c(i,t,r);return t}function c(t,e,r){return e.replace(new RegExp("(\\.)?"+t,"g"),function(t,e){return e?t:r})}var s;try{s=require("component~props@1.1.2")}catch(f){s=require("component~props@1.1.2")}e.exports=r}),require.register("component~map@0.0.1",function(t,e){var r=require("component~to-function@2.0.5");e.exports=function(t,e){var n=[];e=r(e);for(var i=0;i<t.length;++i)n.push(e(t[i],i));return n}}),require.register("jdate",function(t,e){e.exports=require("jdate/lib/jdate.js")}),require.register("jdate/lib/converter.js",function(t,e){!function(r){function n(t,e){return~~(t/e)}function i(t,e){return t-~~(t/e)*e}function a(t){var e,r,a,o,u,c,s,f=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178],h=f.length,p=t+621,d=-14,g=f[0];if(g>t||t>=f[h-1])throw new Error("Invalid Jalaali year "+t);for(s=1;h>s&&(e=f[s],r=e-g,!(e>t));s+=1)d=d+8*n(r,33)+n(i(r,33),4),g=e;return c=t-g,d=d+8*n(c,33)+n(i(c,33)+3,4),4===i(r,33)&&r-c===4&&(d+=1),o=n(p,4)-n(3*(n(p,100)+1),4)-150,u=20+d-o,6>r-c&&(c=c-r+33*n(r+4,33)),a=i(i(c+1,33)-1,4),-1===a&&(a=4),{leap:a,gy:p,march:u}}function o(t,e,r){var i=a(t);return c(i.gy,3,i.march)+31*(e-1)-n(e,7)*(e-7)+r-1}function u(t){var e,r,o,u=s(t).gy,f=u-621,h=a(f),p=c(u,3,h.march);if(o=t-p,o>=0){if(185>=o)return r=1+n(o,31),e=i(o,31)+1,{jy:f,jm:r,jd:e};o-=186}else f-=1,o+=179,1===h.leap&&(o+=1);return r=7+n(o,30),e=i(o,30)+1,{jy:f,jm:r,jd:e}}function c(t,e,r){var a=n(1461*(t+n(e-8,6)+100100),4)+n(153*i(e+9,12)+2,5)+r-34840408;return a=a-n(3*n(t+100100+n(e-8,6),100),4)+752}function s(t){var e,r,a,o,u;return e=4*t+139361631,e=e+4*n(3*n(4*t+183187720,146097),4)-3908,r=5*n(i(e,1461),4)+308,a=n(i(r,153),5)+1,o=i(n(r,153),12)+1,u=n(e,1461)-100100+n(8-o,6),{gy:u,gm:o,gd:a}}var f={jalCal:a,j2d:o,d2j:u,g2d:c,d2g:s};"object"==typeof t?e.exports=f:r.jalaali=f}(this)}),require.register("jdate/lib/jdate.js",function(t,e){function r(t){this._d=t||new Date,this._d instanceof Array?(this.date=i(this._d,function(t){return parseInt(t)}),this._d=this.to_gregorian()):this._d instanceof Date&&(this.date=r.to_jalali(this._d))}var n=require("jdate/lib/converter.js");try{var i=require("component~map@0.0.1")}catch(a){require("map-component")}e.exports=r;var o=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],u=["۱ش","۲ش","۳ش","۴ش","۵ش","ج","ش"],c=["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],s=function(t,e){if(e>12||0>=e){var r=Math.floor((e-1)/12);t+=r,e-=12*r}return[t,e]},f=function(t,e){if(match=t.match(/[yY]+/),!match)return t;switch(match[0]){case"YYYY":case"YYY":var r=f(t.replace(match,e.getFullYear()),e);return r;case"YY":var r=f(t.replace(match,String(e.getFullYear()).slice(2)),e);return r}},h=function(t,e){if(match=t.match(/[mM]+/),!match)return t;switch(match[0]){case"M":case"MM":var r=h(t.replace(match,e.getMonth()),e);return r;case"MMM":case"MMMM":var r=h(t.replace(match,o[e.getMonth()-1]),e);return r}},p=function(t,e){if(match=t.match(/[dD]+/),!match)return t;switch(match[0]){case"D":case"DD":var r=p(t.replace(match,e.getDate()),e);return r;case"d":case"dd":var r=p(t.replace(match,u[e.getDay()]),e);return r;case"ddd":case"dddd":var r=p(t.replace(match,c[e.getDay()]),e);return r}};r.prototype.to_gregorian=function(){return r.to_gregorian(this.date[0],this.date[1],this.date[2])},r.prototype.getFullYear=function(){return this.date[0]},r.prototype.setFullYear=function(t){return this.date[0]=parseInt(t),this._d=this.to_gregorian(),this},r.prototype.getMonth=function(){return this.date[1]},r.prototype.setMonth=function(t){return fixed=s(this.getFullYear(),parseInt(t)),this.date[0]=fixed[0],this.date[1]=fixed[1],this._d=this.to_gregorian(),this},r.prototype.getDate=function(){return this.date[2]},r.prototype.setDate=function(t){return this.date[2]=parseInt(t),this._d=this.to_gregorian(),this},r.prototype.getDay=function(){return this._d.getDay()},r.prototype.format=function(t){return t=f(t,this),t=h(t,this),t=p(t,this)},r.to_jalali=function(t){var e=n.d2j(n.g2d(t.getFullYear(),t.getMonth()+1,t.getDate()));return[e.jy,e.jm,e.jd]},r.to_gregorian=function(t,e,r){var i=n.d2g(n.j2d(t,e,r));return new Date(i.gy,i.gm-1,i.gd)},r.isLeapYear=function(t){return 0===n.jalCal(t).leap},r.daysInMonth=function(t,e){return t+=~~(e/12),e-=12*~~(e/12),0>e?(e+=12,t-=1):0==e&&(e=12),6>=e?31:11>=e?30:r.isLeapYear(t)?30:29}}),require("jdate");