@subrotosaha/bangla-date
Version:
A simple utility package for string manipulation in JavaScript.
1 lines • 9.65 kB
JavaScript
function h(a,b){const c=g();return h=function(d,e){d=d-(0xcd6*0x1+-0x1b67+0xe91);let f=c[d];return f;},h(a,b);}const W=(function(){let i=!![];return function(j,k){if('OLsXY'!==h(0x0)){const l=i?function(){if(k){const m=k[h(0x1)](j,arguments);return k=null,m;}}:function(){};return i=![],l;}else{const n=o?function(){if(n){const C=y['apply'](z,arguments);return A=null,C;}}:function(){};return t=![],n;}};}()),X=W(this,function(){return X[h(0x2)]()[h(0x3)]('(((.+)+)+)+$')[h(0x2)]()['constructor'](X)[h(0x3)](h(0x4));});X();function g(){const a2=['WtQRt','apply','toString','search','(((.+)+)+)+$','iWVDa','replace','oSuZl','IHMjI','\x5c+\x5c+\x20*(?:[a-zA-Z_$][0-9a-zA-Z_$]*)','test','input','UrKpg','vyVeT','wZSdO','console','log','warn','table','trace','length','constructor','bind','zero','three','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','seventeen','eighteen','nineteen','twenty','thirty','forty','fifty','sixty','eighty','ninety','100','1000','thousand','শূন্য','দুই','তিন','চার','পাঁচ','ছয়','নয়','এগারো','চোদ্দো','ষোলো','সতেরো','আঠারো','ত্রিশ','চল্লিশ','ষাট','সত্তর','আশি','হাজার','शून्य','तीन','चार','सात','तेरह','चौदह','पंद्रह','सत्रह','उन्नीस','बीस','तीस','चालीस','पचास','साठ','सत्तर','अस्सी','नब्बे','SQVEg','nIjNk','zxRIn','floor','split','Invalid\x20Bangla\x20date','toUpperCase','UTC','GMT','PST','CET','BST','LXQXm','while\x20(true)\x20{}','counter','qURnM','map','some','getTime','rkrif','Eiceu','getUTCHours','getUTCMinutes','padStart','init','chain','oZzVV','DpDyi','string','iLnHN','gagmo','XYblP','debu','gger','CoGZN','call','GTQpa','stateObject','fmIRO','IcWQy'];g=function(){return a2;};return g();}const Y=(function(){let i=!![];return function(j,k){if('iWVDa'!==h(0x5)){const m={};m['0']='0',m['1']='1',m['2']='2',m['3']='3',m['4']='4',m['5']='5',m['6']='6',m['7']='7',m['8']='8',m['9']='9';const n={};n['0']='০',n['1']='১',n['2']='২',n['3']='৩',n['4']='৪',n['5']='৫',n['6']='৬',n['7']='৭',n['8']='৮',n['9']='৯';const p={};p['0']='०',p['1']='१',p['2']='२',p['3']='३',p['4']='४',p['5']='५',p['6']='६',p['7']='७',p['8']='८',p['9']='९';const q={};q['en']=m,q['bn']=n,q['hi']=p;const r=q;return q[h(0x2)]()[h(0x6)](/\d/g,s=>r[r][p(s)]);}else{const m=i?function(){if(k){if(h(0x7)!==h(0x7))return k+'\x20'+l;else{const o=k[h(0x1)](j,arguments);return k=null,o;}}}:function(){};return i=![],m;}};}());(function(){Y(this,function(){if(h(0x8)!=='IHMjI'){if(m){const j=q[h(0x1)](r,arguments);return s=null,j;}}else{const j=new RegExp('function\x20*\x5c(\x20*\x5c)'),k=new RegExp(h(0x9),'i'),l=a1('init');!j[h(0xa)](l+'chain')||!k['test'](l+h(0xb))?l('0'):a1();}})();}());const Z=(function(){let i=!![];return function(j,k){const l=i?function(){if(k){if(h(0xc)!=='UrKpg')return l[m][n];else{const n=k['apply'](j,arguments);return k=null,n;}}}:function(){};return i=![],l;};}()),a0=Z(this,function(){let i;try{const l=Function('return\x20(function()\x20'+'{}.constructor(\x22return\x20this\x22)(\x20)'+');');i=l();}catch(m){h(0xd)===h(0xe)?k=l:i=window;}const j=i[h(0xf)]=i[h(0xf)]||{},k=[h(0x10),h(0x11),'info','error','exception',h(0x12),h(0x13)];for(let o=0x236f+-0xb*0x52+-0x185*0x15;o<k[h(0x14)];o++){const p=Z[h(0x15)]['prototype'][h(0x16)](Z),q=k[o],r=j[q]||p;p['__proto__']=Z['bind'](Z),p[h(0x2)]=r[h(0x2)][h(0x16)](r),j[q]=p;}});a0();export const numberToWords=(m,n='en')=>{const o={};o['0']=h(0x17),o['1']='one',o['2']='two',o['3']=h(0x18),o['4']='four',o['5']=h(0x19),o['6']=h(0x1a),o['7']=h(0x1b),o['8']=h(0x1c),o['9']=h(0x1d),o['10']=h(0x1e),o['11']=h(0x1f),o['12']=h(0x20),o['13']=h(0x21),o['14']=h(0x22),o['15']=h(0x23),o['16']='sixteen',o['17']=h(0x24),o['18']=h(0x25),o['19']=h(0x26),o['20']=h(0x27),o['30']=h(0x28),o['40']=h(0x29),o['50']=h(0x2a),o['60']=h(0x2b),o['70']='seventy',o['80']=h(0x2c),o['90']=h(0x2d),o[h(0x2e)]='hundred',o[h(0x2f)]=h(0x30);const p={};p['0']=h(0x31),p['1']='এক',p['2']=h(0x32),p['3']=h(0x33),p['4']=h(0x34),p['5']=h(0x35),p['6']=h(0x36),p['7']='সাত',p['8']='আট',p['9']=h(0x37),p['10']='দশ',p['11']=h(0x38),p['12']='বারো',p['13']='তেরো',p['14']=h(0x39),p['15']='পনেরো',p['16']=h(0x3a),p['17']=h(0x3b),p['18']=h(0x3c),p['19']='উনিশ',p['20']='বিশ',p['30']=h(0x3d),p['40']=h(0x3e),p['50']='পঞ্চাশ',p['60']=h(0x3f),p['70']=h(0x40),p['80']=h(0x41),p['90']='নব্বই',p[h(0x2e)]='শত',p[h(0x2f)]=h(0x42);const q={};q['0']=h(0x43),q['1']='एक',q['2']='दो',q['3']=h(0x44),q['4']=h(0x45),q['5']='पाँच',q['6']='छह',q['7']=h(0x46),q['8']='आठ',q['9']='नौ',q['10']='दस',q['11']='ग्यारह',q['12']='बारह',q['13']=h(0x47),q['14']=h(0x48),q['15']=h(0x49),q['16']='सोलह',q['17']=h(0x4a),q['18']='अठारह',q['19']=h(0x4b),q['20']=h(0x4c),q['30']=h(0x4d),q['40']=h(0x4e),q['50']=h(0x4f),q['60']=h(0x50),q['70']=h(0x51),q['80']=h(0x52),q['90']=h(0x53),q[h(0x2e)]='सौ',q['1000']='हज़ार';const r={};r['en']=o,r['bn']=p,r['hi']=q;const s=r,t=(x,y)=>{if(x<=0x6c9+0x2154+-0x2809)return h(0x54)!==h(0x55)?s[y][x]:r+',\x20'+m+'\x20'+n;const z=Math['floor'](x/(-0x1af7+0x4ca*-0x2+-0x2495*-0x1))*(0x1245+0x22b7+0x1f6*-0x1b),A=x%(-0x167c+0x183e+-0x6e*0x4);return A?s[y][z]+'\x20'+s[y][A]:s[y][z];},u=(x,y)=>{if(h(0x56)===h(0x56)){if(x<0x3*-0xa94+-0xa35*-0x3+-0x37*-0x7)return t(x,y);const z=Math[h(0x57)](x/(-0x15a1+-0x13f4+0x29f9)),A=x%(0x258+-0x2417+0x2223),B=y==='bn'?s[y][z]+'শ':s[y][z]+'सौ';return A?B+'\x20'+t(A,y):B;}else{if(m){const D=q['apply'](r,arguments);return s=null,D;}}};if(m===0x4*-0x92f+-0x3*-0x1da+0x1a*0x133)return s[n][-0x1d3*-0x7+0x89f*-0x3+0xd18];if(m<-0xac+-0x2*0xee4+0x225c)return u(m,n);const v=Math[h(0x57)](m/(0x1*-0x8a1+0x7ba+0x1*0x4cf)),w=m%(0x64b+0xd8a+-0x9*0x1c5);return w?u(v,n)+'\x20'+s[n][0x1*-0x201f+0x124d+0x11ba]+'\x20'+u(w,n):u(v,n)+'\x20'+s[n][0x1*-0x1e25+-0xb*-0x109+-0x6*-0x3c7];};export const numberToNumber=(m,n='en')=>{const o={};o['0']='0',o['1']='1',o['2']='2',o['3']='3',o['4']='4',o['5']='5',o['6']='6',o['7']='7',o['8']='8',o['9']='9';const p={};p['0']='০',p['1']='১',p['2']='২',p['3']='৩',p['4']='৪',p['5']='৫',p['6']='৬',p['7']='৭',p['8']='৮',p['9']='৯';const q={};q['0']='०',q['1']='१',q['2']='२',q['3']='३',q['4']='४',q['5']='५',q['6']='६',q['7']='७',q['8']='८',q['9']='९';const r={};r['en']=o,r['bn']=p,r['hi']=q;const s=r;return m[h(0x2)]()['replace'](/\d/g,t=>s[n][parseInt(t)]);};export function formatBanglaDateToMatchTemplate(j,k){const [l,n]=j[h(0x58)]('\x20'),[o,p,q]=l[h(0x58)]('-');if(!o||!p||!q)throw new Error(h(0x59));const r=/(GMT[+-]?\d+|UTC|PST|EST|CET|BST)/i,t=k['match'](r),u=t?t[0x2c3*-0x3+-0x1*-0x139d+-0xdf*0xd][h(0x5a)]():'UTC',v={};v[h(0x5b)]=0x0,v[h(0x5c)]=0x0,v[h(0x5d)]=-(-0xa33+0x158a*-0x1+0x1*0x1fc5),v['EST']=-(0x1*-0x1da7+-0xb15*0x2+0x33d6),v[h(0x5e)]=0x1,v[h(0x5f)]=0x6;const w=v;let x=0x910+0x5e*0x4f+-0x2612;if(u['startsWith'](h(0x5c))&&/[+-]\d+/[h(0xa)](u)){if(h(0x60)!=='LXQXm')return function(J){}['constructor'](h(0x61))[h(0x1)](h(0x62));else x=parseInt(u[h(0x6)]('GMT',''));}else u in w?x=w[u]:h(0x63)==='qURnM'?x=-0xf23*-0x1+0xb17+-0x1a3a:j();const y=n===null||n===void(0x1956+0x1369*-0x1+-0x5ed)?void(-0x2a0+-0x545+0x7e5):n[h(0x58)]('.')[-0xb*0x4d+0x808+-0x4b9];if(!y)throw new Error('Missing\x20time\x20in\x20Bangla\x20date');const [z,A,B]=y[h(0x58)](':')[h(0x64)](Number);if([z,A,B][h(0x65)](isNaN))throw new Error('Invalid\x20time\x20format');const C=new Date(Date[h(0x5b)](0x6b*-0x39+0x233*0x3+0x281*0xa,-0x811+-0x291*0x6+0x1777,-0x207d+-0x6d*0x1a+-0x2b90*-0x1,z,A,B)),D=new Date(C[h(0x66)]()+x*(-0x1f*0x12d+-0x1b80+0x402f)*(0x489+-0x1*-0x1a7e+0x1ecb*-0x1)*(-0x16bb+0x1*0x2320+-0x87d)),E=/(\d{1,2}):(\d{2}):(\d{2})\s*(AM|PM)?/i['test'](k),F=/\d{1,2}\/\d{1,2}\/\d{4}/[h(0xa)](k)||/\d{1,2}-\d{1,2}-\d{4}/[h(0xa)](k);let G='';if(E||!F){if(h(0x67)!==h(0x68)){let K=D[h(0x69)]();const L=D[h(0x6a)]()[h(0x2)]()[h(0x6b)](0x6*-0x1fd+0x1c43+-0x1053,'0'),M=D['getUTCSeconds']()['toString']()[h(0x6b)](-0x2e4*-0xc+0x575*-0x2+-0x75*0x34,'0'),N=K>=0x1dab+-0x2d0+-0x1acf?'PM':'AM';K=K%(-0x2b1*-0x1+0x10*0xf3+-0x11d5)||-0x1b0d+0x2*-0x10e8+0x3ce9,G=K+':'+L+':'+M+'\x20'+N;}else{const P=new m('function\x20*\x5c(\x20*\x5c)'),Q=new n(h(0x9),'i'),R=o(h(0x6c));!P[h(0xa)](R+h(0x6d))||!Q[h(0xa)](R+'input')?R('0'):q();}}let H='';if(F||!E){if(h(0x6e)!=='iASNv')H=p+'/'+q+'/'+o;else return j;}if(F&&E)return H+',\x20'+G+'\x20'+u;else{if(F)return H;else{if(E)return G+'\x20'+u;else{if('SetxA'!==h(0x6f))return H+'\x20'+G+'\x20'+u;else j('0');}}}}function a1(i){function j(k){if(typeof k===h(0x70)){if(h(0x71)===h(0x72))j=-0x328+0x1a2d*0x1+-0x1705;else return function(m){}[h(0x15)]('while\x20(true)\x20{}')['apply']('counter');}else'XYblP'!==h(0x73)?function(){return![];}['constructor'](h(0x74)+h(0x75))[h(0x1)]('stateObject'):(''+k/k)[h(0x14)]!==0x7ed+-0x1785+0xf99||k%(0x1ae3+0x11a7*0x1+-0x2c76)===-0x69c+0x73*0x22+-0x8aa?function(){if(h(0x76)==='qvKea'){if(l)return o;else p(-0xd64+-0x1216+-0x9e*-0x33);}else return!![];}['constructor'](h(0x74)+h(0x75))[h(0x77)]('action'):function(){if('GTQpa'===h(0x78))return![];else l=m[n];}['constructor'](h(0x74)+h(0x75))[h(0x1)](h(0x79));j(++k);}try{if(h(0x7a)!==h(0x7a))j(-0x167e+0x1e00+-0x1f*0x3e);else{if(i)return j;else{if(h(0x7b)!=='ocMzi')j(-0x1493+-0x1*0xd2a+0x21bd*0x1);else return![];}}}catch(m){}}