You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.6 KiB

2 years ago
"use strict";var e={name:"persian",startYear:1,yearLength:365,epoch:1948319,century:14,weekStartDayIndex:0,getMonthLengths:e=>[31,31,31,31,31,31,30,30,30,30,30,e?30:29],isLeap(e){return this.getLeaps(e).includes(e)},getLeaps(e){if(0===e)return;let t=e>0?1:-1,r=[],s=.242362,a=e>0?.2684:.7316,n={5:4,38:37,199:198,232:231,265:264,298:297,557:558,590:591,623:624,982:983,1015:1016,1048:1049,1081:1082,1114:1115,1242:1243,1374:1375,1407:1408,1440:1441,1506:1507,1539:1540,1572:1573,1605:1606,1931:1932,1964:1965,2063:2064,2096:2097,2687:2686,2720:2719,2753:2752,2819:2818,2852:2851,2885:2884,3017:3016,3112:3111,3145:3144,3178:3177,3211:3210,3244:3243,3277:3276,3310:3309,3343:3342,3376:3375,3409:3408,3442:3441,3508:3507,3541:3540,3574:3573,3603:3602,3607:3606,3636:3635,3669:3668,3702:3701,3706:3705,3735:3734,3768:3767,3801:3800,3834:3833,3867:3866,3900:3899,3933:3932,3966:3965,3999:3998,4065:4064,4094:4093,4098:4097,4127:4126,4131:4130,4160:4159,4193:4192,4226:4225,4259:4258,4292:4291,4325:4324,4358:4357,4391:4390,4585:4584,4618:4617,4651:4650,4750:4749,4943:4944,4976:4977,5009:5010,5170:5171,5203:5204,5236:5237,5265:5266,5269:5270,5298:5299,5302:5303,5331:5332,5335:5336,5364:5365,5368:5369,5393:5394,5397:5398,5401:5402,5426:5427,5430:5431,5434:5435,5459:5460,5463:5464,5467:5468,5492:5493,5496:5497,5500:5501,5521:5522,5525:5526,5529:5530,5554:5555,5558:5559,5562:5563,5587:5588,5591:5592,5595:5596,5616:5617,5620:5621,5624:5625,5628:5629,5649:5650,5653:5654,5657:5658,5661:5662,5682:5683,5686:5687,5690:5691,5694:5695,5715:5716,5719:5720,5723:5724,5727:5728,5744:5745,5748:5749,5752:5753,5756:5757,5760:5761,5777:5778,5781:5782,5785:5786,5789:5790,5793:5794,5810:5811,5814:5815,5818:5819,5822:5823,5826:5827,5839:5840,5843:5844,5847:5848,5851:5852,5855:5856,5859:5860,5872:5873,5876:5877,5880:5881,5884:5885,5888:5889,5892:5893,5901:5902,5905:5906,5909:5910,5913:5914,5917:5918,5921:5922,5925:5926,5934:5935,5938:5939,5942:5943,5946:5947,5950:5951,5954:5955,5958:5959,5967:5968,5971:5972,5975:5976,5979:5980,5983:5984,5987:5988,5991:5992,5996:5997,6e3:6001,6004:6005,6008:6009,6012:6013,6016:6017,6020:6021,6029:6030,6033:6034,6037:6038,6041:6042,6045:6046,6049:6050,6053:6054,6058:6059,6062:6063,6066:6067,6070:6071,6074:6075,6078:6079,6082:6083,6086:6087,6091:6092,6095:6096,6099:6100,6103:6104,6107:6108,6111:6112,6115:6116,6119:6120,6124:6125,6128:6129,6132:6133,6136:6137,6140:6141,6144:6145,6148:6149,6152:6154,6157:6158,6161:6162,6165:6166,6169:6170,6173:6174,6177:6178,6181:6182,6185:6187,6190:6191,6194:6195,6198:6199,6202:6203,6206:6207,6210:6211,6214:6215,6218:6220,6223:6224,6227:6228,6231:6232,6235:6236,6239:6240,6243:6244,6247:6249,6251:6253,6256:6257,6260:6261,6264:6265,6268:6269,6272:6273,6276:6277,6280:6282,6284:6286,6289:6290,6293:6294,6297:6298,6301:6302,6305:6306,6309:6310,6313:6315,6317:6319,6322:6323,6326:6327,6330:6331,6334:6335,6338:6339,6342:6344,6346:6348,6350:6352,6355:6356,6359:6360,6363:6364,6367:6368,6371:6372,6375:6377,6379:6381,6383:6385,6388:6389,6392:6393,6396:6397,6400:6401,6404:6406,6408:6410,6412:6414,6416:6418,6421:6422,6425:6426,6429:6430,6433:6434,6437:6439,6441:6443,6445:6447,6449:6451,6454:6455,6458:6459,6462:6463,6466:6468,6470:6472,6474:6476,6478:6480,6482:6484,6487:6488,6491:6492,6495:6496};for(;e>0?t<=e:e<=t;){if(a+=e>0?s:-1*s,a>1&&(a-=1),a<0&&(a+=1),a>=.257800926&&a<=.5){let s=n[t]||t<-1?t+1:t;e>0&&s<=e&&r.push(s),e<0&&r.push(s)}e>0?t++:t--}return r},getDayOfYear:({month:{index:e},day:t})=>(e<=6?31*e:186+30*(e-6))+t,getAllDays(e){const{year:t}=e,r=this.getLeaps(t),s=r.includes(t);return this.yearLength*(t-1)+(s?r.length-1:r.length)+this.getDayOfYear(e)},guessYear:(e,t)=>~~((e+.5)/365.241)+(t>0?1:-1)};module.exports=e;