@coreify/tarikh 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +502 -387
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +71 -15
- package/dist/index.d.ts +71 -15
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.d.cts +20 -0
- package/dist/react.d.ts +20 -0
- package/dist/react.js +1 -1
- package/package.json +94 -94
package/dist/react.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("react"),t=["0","1","2","3","4","5","6","7","8","9"],n=["০","১","২","৩","৪","৫","৬","৭","৮","৯"],r=["January","February","March","April","May","June","July","August","September","October","November","December"],o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],u=["জানুয়ারি","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],s=["জানু","ফেব্রু","মার্চ","এপ্রি","মে","জুন","জুলা","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],d=["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"],l=["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],c=["বৈশাখ","জ্যৈষ্ঠ","আষাঢ়","শ্রাবণ","ভাদ্র","আশ্বিন","কার্তিক","অগ্রহায়ণ","পৌষ","মাঘ","ফাল্গুন","চৈত্র"],m=["Baishakh","Jaishtho","Asharh","Shrabon","Bhadro","Ashshin","Kartik","Agrahayan","Poush","Magh","Falgun","Chaitra"],g=[31,31,31,31,31,30,30,30,30,30,30,30],h={second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",day:"day",days:"days",week:"week",weeks:"weeks",month:"month",months:"months",year:"year",years:"years",ago:"ago",in:"in",justNow:"just now"},f={second:"সেকেন্ড",seconds:"সেকেন্ড",minute:"মিনিট",minutes:"মিনিট",hour:"ঘণ্টা",hours:"ঘণ্টা",day:"দিন",days:"দিন",week:"সপ্তাহ",weeks:"সপ্তাহ",month:"মাস",months:"মাস",year:"বছর",years:"বছর",ago:"আগে",in:"",justNow:"এইমাত্র"};function y(e){return String(e).replace(/\d/g,e=>n[Number(e)]??e)}function b(e){return String(e).replace(/[০-৯]/g,e=>{const r=n.indexOf(e);return r>=0?t[r]??e:e})}var w={jan:0,"jan.":0,january:0,"january,":0,feb:1,"feb.":1,february:1,"february,":1,mar:2,"mar.":2,march:2,"march,":2,apr:3,"apr.":3,april:3,"april,":3,may:4,"may,":4,jun:5,"jun.":5,june:5,"june,":5,jul:6,"jul.":6,july:6,"july,":6,aug:7,"aug.":7,august:7,"august,":7,sep:8,sept:8,"sep.":8,"sept.":8,september:8,"september,":8,oct:9,"oct.":9,october:9,"october,":9,nov:10,"nov.":10,november:10,"november,":10,dec:11,"dec.":11,december:11,"december,":11,"জানুয়ারি":0,"জানুয়ারি":0,"ফেব্রুয়ারি":1,"ফেব্রুয়ারি":1,"মার্চ":2,"এপ্রিল":3,"মে":4,"জুন":5,"জুলাই":6,"আগস্ট":7,"অগাস্ট":7,"সেপ্টেম্বর":8,"সেপ্টেম্বার":8,"অক্টোবর":9,"নভেম্বর":10,"নভেম্বার":10,"ডিসেম্বর":11,"ডিসেম্বার":11,"জানু":0,"ফেব্রু":1,"এপ্রি":3,"জুলা":6,"আগ":7,"সেপ্টে":8,"অক্টো":9,"নভে":10,"ডিসে":11};function $(e){const t=e.trim(),n=t.toLowerCase(),a=w[n];if(void 0!==a)return a;for(let e=0;e<r.length;e++)if(r[e].toLowerCase()===n)return e;for(let e=0;e<o.length;e++)if(o[e].toLowerCase()===n)return e;for(let e=0;e<u.length;e++)if(u[e]===t)return e;for(let e=0;e<s.length;e++)if(s[e]===t)return e;return-1}function p(e){return Number.isFinite(e)&&Math.abs(e)<=864e13}function v(e,t,n,r=0,o=0,a=0,i=0){const u=new Date(0);return u.setUTCFullYear(e,t,n),u.setUTCHours(r,o,a,i),u.getUTCFullYear()!==e||u.getUTCMonth()!==t||u.getUTCDate()!==n||u.getUTCHours()!==r||u.getUTCMinutes()!==o||u.getUTCSeconds()!==a||u.getUTCMilliseconds()!==i?null:u}function D(e,t,n,r=0,o=0,a=0,i=0){return function(e,t,n,r=0,o=0,a=0,i=0){const u=new Date(0);return u.setFullYear(e,t,n),u.setHours(r,o,a,i),u.getFullYear()!==e||u.getMonth()!==t||u.getDate()!==n||u.getHours()!==r||u.getMinutes()!==o||u.getSeconds()!==a||u.getMilliseconds()!==i?null:u}(e,t,n,r,o,a,i)??v(e,t,n,r,o,a,i)}function M(e){if(!/^[+-]?\d+$/.test(e))return null;const t=Number(e);return Number.isInteger(t)?t:null}function T(e){return function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})([-/.])(\d{1,2})\2(\d{1,2})$/);return t?D(Number(t[1]),Number(t[3])-1,Number(t[4])):null}(e)??function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:?\d{2})?)$/);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),o=Number(t[3]),a=Number(t[4]??0),i=Number(t[5]??0),u=Number(t[6]??0),s=Number((t[7]??"0").padEnd(3,"0").slice(0,3)),d=t[8];if(void 0===d)return D(n,r-1,o,a,i,u,s);const l=d.match(/^([+-])(\d{2}):?(\d{2})$/),c=l?Number(l[2]):null,m=l?Number(l[3]):null,g="Z"===d?0:l&&null!==c&&null!==m&&c<=23&&m<=59?("+"===l[1]?1:-1)*(60*c+m):null;if(null===g)return null;const h=v(n,r-1,o,a,i,u,s);if(!h)return null;const f=h.getTime()-6e4*g;if(!p(f))return null;const y=new Date(f),b=new Date(f+6e4*g);return b.getUTCFullYear()!==n||b.getUTCMonth()!==r-1||b.getUTCDate()!==o||b.getUTCHours()!==a||b.getUTCMinutes()!==i||b.getUTCSeconds()!==u||b.getUTCMilliseconds()!==s?null:y}(e)??function(e){const t=e.match(/^(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:\s+|-)(\S+)(?:\s+|-)([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=Number(t[1]),r=t[2].replace(/,$/,""),o=t[3],a=$(r);if(-1===a)return null;const i=M(o);if(null===i)return null;let u=i;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),D(u,a,n)}(e)??function(e){const t=e.match(/^(\S+)\s+(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:,)?\s+([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=t[1].replace(/,$/,""),r=Number(t[2]),o=t[3],a=$(n);if(-1===a)return null;const i=M(o);if(null===i)return null;let u=i;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),D(u,a,r)}(e)}function N(e,t,n){if(!p(e.getTime())){throw new RangeError(`${"Date input"} is outside the supported range: ${String(t)}`)}return e}function S(e){if(e instanceof Date){const t=e.getTime();if(Number.isNaN(t))throw new Error(`Invalid date input: ${String(e)}`);return N(new Date(t),e)}if("number"==typeof e){if(!Number.isFinite(e))throw new Error(`Invalid date input: ${String(e)}`);const t=new Date(e);if(Number.isNaN(t.getTime())){if(!p(e))throw new RangeError(`Date input is outside the supported range: ${String(e)}`);throw new Error(`Invalid date input: ${String(e)}`)}return N(t,e)}const t=T(b(e).trim());if(!t)throw new Error(`Invalid date input: ${String(e)}`);return N(t,e)}function Y(e,t){const n=S(e),r=n.getFullYear(),o=n.getMonth(),a=n.getDate(),i=new Date(r,3,14),u=o<3||3===o&&a<14,s=u?r-594:r-593,d=function(e,t){const n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.floor((r-n)/864e5)}(u?new Date(r-1,3,14):i,n)+1,l=function(e){const t=[...g];return function(e){return(t=e+594)%4==0&&t%100!=0||t%400==0;var t}(e)&&(t[10]=31),t}(s);let c=d,h=0;for(let e=0;e<l.length;e++){const t=l[e];if(c<=t){h=e;break}c-=t}return{day:c,month:m[h],monthIndex:h+1,year:s}}var F=["Asia/Dhaka","UTC"];function k(e,t){const n=e.find(e=>e.type===t);if(void 0===n)throw new Error(`Missing ${t} part while formatting Hijri date.`);return n.value}function j(e,t){const n=t?.locale??"en-BD",r=t?.timeZone??"Asia/Dhaka";!function(e){if(!F.includes(e))throw new RangeError(`Unsupported Hijri time zone: ${e}. Supported values: ${F.join(", ")}`)}(r);const o=function(e,t,n){const r=function(e){return`${e}-u-ca-islamic-umalqura`}(t),o=new Intl.DateTimeFormat(r,{day:"numeric",month:"numeric",year:"numeric",timeZone:n}).formatToParts(e),a=new Intl.DateTimeFormat(r,{day:"numeric",month:"long",year:"numeric",timeZone:n}).formatToParts(e);return{day:k(o,"day"),month:k(a,"month"),monthIndex:Number(b(k(o,"month"))),year:k(o,"year")}}(S(e),n,r);return"bn-BD"===n?{day:y(o.day),month:o.month,monthIndex:o.monthIndex,year:y(o.year)}:{day:Number(b(o.day)),month:o.month,monthIndex:o.monthIndex,year:Number(b(o.year))}}function C(e){const t=y(e);return 1===e?`${t}লা`:2===e||3===e?`${t}রা`:4===e?`${t}ঠা`:e>=19?`${t}শে`:`${t}ই`}function B(e){const t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function H(e,t){return"spoken"===(t?.format??"ordinal")?function(e,t="pohela"){switch(e){case 1:return"poyla"===t?"পয়লা":"পহেলা";case 2:return"দোসরা";case 3:return"তেসরা";case 4:return"চৌঠা";default:return C(e)}}(e,t?.variant):C(e)}function U(e,t){return"2-digit"===t?String(e).padStart(2,"0"):String(e)}function E(e,t,n){const r=U(e,n);return"bn-BD"===t?y(r):r}function I(e,t,n){if(!t.includes(e))throw new TypeError(`Invalid ${n}: ${e}`)}function x(e,t,n){if("bn-BD"===t)return e<12?"পূর্বাহ্ণ":"অপরাহ্ণ";const r=e<12?"AM":"PM";return n?r.toLowerCase():r}function A(e,t){if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError("format() expects an options object");if("pattern"in t&&void 0!==t.pattern){if("mode"in t&&void 0!==t.mode)throw new TypeError("Do not pass `mode` when `pattern` is provided. `pattern` formatting does not use mode.");const n="locale"in t&&void 0!==t.locale?t.locale:"en-BD";return function(e,t,n="en-BD"){const c=S(e),m="bn-BD"===n,g=c.getDate(),h=c.getMonth(),f=c.getFullYear(),y=m?u:r,b=m?s:o,w=m?d:a,$=m?l:i,p=c.getHours(),v=p%12||12,D={dddd:w[c.getDay()],ddd:$[c.getDay()],MMMM:y[h],MMM:b[h],MM:E(h+1,n,"2-digit"),M:E(h+1,n,"numeric"),DD:E(g,n,"2-digit"),D:E(g,n,"numeric"),HH:E(p,n,"2-digit"),H:E(p,n,"numeric"),hh:E(v,n,"2-digit"),h:E(v,n,"numeric"),mm:E(c.getMinutes(),n,"2-digit"),m:E(c.getMinutes(),n,"numeric"),ss:E(c.getSeconds(),n,"2-digit"),s:E(c.getSeconds(),n,"numeric"),A:x(p,n,!1),a:x(p,n,!0),YYYY:E(f,n,"numeric"),YY:E(Number(String(f).slice(-2)),n,"2-digit")},M=/dddd|ddd|MMMM|MMM|MM|M|DD|D|YYYY|YY|HH|H|hh|h|mm|m|ss|s|A|a/g,T=e=>e.replace(M,e=>D[e]);let N="",Y=0;for(;Y<t.length;){const e=t.indexOf("[",Y);if(-1===e){N+=T(t.slice(Y));break}N+=T(t.slice(Y,e));const n=t.indexOf("]",e+1);if(-1===n){N+=t.slice(e);break}N+=t.slice(e+1,n),Y=n+1}return N}(e,t.pattern,n)}if(!("mode"in t)||void 0===t.mode)throw new TypeError("format() expects `mode` or `pattern`");const n=t.mode;switch(n){case"standard":return function(e,t){const n=S(e),c=t?.locale??"en-BD",m=t?.month??"short",g=t?.year??"numeric",h=t?.day??"numeric",f=t?.weekday,b=t?.hour,w=t?.minute,$=t?.second,p=void 0!==b||void 0!==w||void 0!==$,v="bn-BD"===c;I(m,["short","long"],"month format for standard mode"),I(g,["numeric","2-digit"],"year format for standard mode"),I(h,["numeric","2-digit"],"day format for standard mode"),void 0!==f&&I(f,["short","long"],"weekday format for standard mode"),void 0!==b&&I(b,["numeric","2-digit"],"hour format for standard mode"),void 0!==w&&I(w,["numeric","2-digit"],"minute format for standard mode"),void 0!==$&&I($,["numeric","2-digit"],"second format for standard mode");const D=n.getDate(),M=n.getMonth(),T=n.getFullYear(),N=v?" খ্রিস্টাব্দ":"",Y=`${"2-digit"===h?String(D).padStart(2,"0"):v?C(D):B(D)} ${(v?"short"===m?s:u:"short"===m?o:r)[M]} ${"2-digit"===g?String(T).slice(-2):String(T)}${N}`,F=void 0!==f?`${(v?"short"===f?l:d:"short"===f?i:a)[n.getDay()]}, `:"";let k="";if(p){const e=t?.hour12??!1,r=n.getHours(),o=w??(void 0!==$?"2-digit":void 0);k=`${U(e?r%12||12:r,b??"numeric")}${void 0!==o?`:${U(n.getMinutes(),o)}`:""}${void 0!==$?`:${U(n.getSeconds(),$)}`:""}${e?` ${x(r,c,!1)}`:""}`}const j=`${F}${Y}${k?`, ${k}`:""}`;return v?y(j):j}(e,t);case"bangla":return function(e,t){const n=t?.locale??"en-BD",r=t?.format??"ordinal",o=t?.variant,a=Y(e);if("bn-BD"===n){const e=a.monthIndex-1,t={format:r};return void 0!==o&&(t.variant=o),`${H(a.day,t)} ${c[e]} ${y(a.year)} বঙ্গাব্দ`}return`${B(a.day)} ${a.month} ${a.year}`}(e,t);case"hijri":return function(e,t){const n=t?.locale??"en-BD",r=t?.timeZone;if("bn-BD"===n){const t={locale:n};void 0!==r&&(t.timeZone=r);const o=j(e,t),a=y(o.year);return`${function(e){const t=y(e);return 1===e?`${t}লা`:2===e?`${t}রা`:`${t}ই`}(Number(b(o.day)))} ${o.month} ${a} হিজরি`}const o={locale:n};void 0!==r&&(o.timeZone=r);const a=j(e,o);return`${B(a.day)} ${a.month} ${a.year} AH`}(e,t);case"hybrid":return function(e,t){const n=S(e),a=t?.digits??"en",i=t?.month??"bn",d=t?.year??"en",l=t?.day??a,c=t?.monthFormat??"long";I(a,["en","bn"],"digits language for hybrid mode"),I(i,["en","bn"],"month language for hybrid mode"),I(d,["en","bn"],"year language for hybrid mode"),I(l,["en","bn"],"day language for hybrid mode"),I(c,["short","long"],"month format for hybrid mode");const m=n.getDate(),g=n.getMonth(),h=n.getFullYear(),f="bn"===i?"short"===c?s:u:"short"===c?o:r,b="bn"===l?y(m):String(m),w=f[g],$="bn"===d?y(h):String(h);return`${b} ${w} ${$}`}(e,t);default:throw new TypeError(`Invalid format mode: ${String(n)}`)}}var Z=1e3,R=36e5,L=24*R,J=[{threshold:7*L,singular:"week",plural:"weeks"},{threshold:L,singular:"day",plural:"days"},{threshold:R,singular:"hour",plural:"hours"},{threshold:6e4,singular:"minute",plural:"minutes"},{threshold:Z,singular:"second",plural:"seconds"}];function O(e,t){return new Date(e,t+1,0).getDate()}function W(e,t){let n=e.getFullYear()-t.getFullYear();const r=function(e,t){const n=e.getFullYear()+t,r=e.getMonth(),o=Math.min(e.getDate(),O(n,r));return new Date(n,r,o,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function P(e,t){let n=12*(e.getFullYear()-t.getFullYear())+(e.getMonth()-t.getMonth());const r=function(e,t){const n=e.getFullYear(),r=e.getMonth()+t,o=n+Math.floor(r/12),a=(r%12+12)%12,i=Math.min(e.getDate(),O(o,a));return new Date(o,a,i,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function q(e,t,n,r,o){const a="bn-BD"===o,i=a?y(e):String(e),u=1===e?t:n;return a?r?`${i} ${u} আগে`:`${i} ${u} পরে`:r?`${i} ${u} ago`:`in ${i} ${u}`}function z(e,t,n){return"bn-BD"===n?"day"===e?t?"গতকাল":"আগামীকাল":"week"===e?t?"গত সপ্তাহে":"আগামী সপ্তাহে":"month"===e?t?"গত মাসে":"আগামী মাসে":t?"গত বছর":"আগামী বছর":"day"===e?t?"yesterday":"tomorrow":"week"===e?t?"last week":"next week":"month"===e?t?"last month":"next month":t?"last year":"next year"}function K(e){return"string"==typeof e&&!/(?:T|\s)\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/i.test(e.trim())&&null!==function(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:new Date(e.getTime());if("number"==typeof e){const t=new Date(e);return Number.isNaN(t.getTime())?null:t}return T(b(e).trim())}(e)}function G(e,t){return K(e)?function(e){return`${String(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}(t):t.toISOString()}var Q=e.forwardRef(function({value:t,locale:n,month:r,year:o,day:a,weekday:i,hour:u,minute:s,second:d,hour12:l,srLabel:c,"aria-label":m,...g},h){const f=S(t),y=A(f,{mode:"standard",...{...void 0!==n&&{locale:n},...void 0!==r&&{month:r},...void 0!==o&&{year:o},...void 0!==a&&{day:a},...void 0!==i&&{weekday:i},...void 0!==u&&{hour:u},...void 0!==s&&{minute:s},...void 0!==d&&{second:d},...void 0!==l&&{hour12:l}}}),b=G(t,f),w=c??m??y;return e.createElement("time",{...g,ref:h,dateTime:b,"aria-label":w},y)});Q.displayName="Tarikh";var V=e.forwardRef(function({value:t,locale:n,numeric:r,srLabel:o,"aria-label":a,...i},u){const s=S(t),d={...void 0!==n&&{locale:n},...void 0!==r&&{numeric:r}},l=function(e,t){const n=S(e),r=t?.locale??"en-BD",o=t?.numeric??"always",a="bn-BD"===r?f:h,i=Date.now()-n.getTime(),u=Math.abs(i),s=i>0,d=new Date,l=n.getFullYear()===d.getFullYear()&&n.getMonth()===d.getMonth()&&n.getDate()===d.getDate(),c=s?d:n,m=s?n:d;if(u<Z)return a.justNow;if("auto"===o&&l)return function(e){return"bn-BD"===e?"আজ":"today"}(r);const g=W(c,m);if(g>=1){if("auto"===o&&1===g){const e=z("year",s,r);if(null!==e)return e}return q(g,a.year,a.years,s,r)}const y=P(c,m);if(y>=1){if("auto"===o&&1===y){const e=z("month",s,r);if(null!==e)return e}return q(y,a.month,a.months,s,r)}for(const e of J)if(u>=e.threshold){const t=Math.floor(u/e.threshold);if("auto"===o&&1===t&&("day"===e.singular||"week"===e.singular)){const t=z(e.singular,s,r);if(null!==t)return t}return q(t,a[e.singular],a[e.plural],s,r)}return a.justNow}(s,Object.keys(d).length>0?d:void 0),c=G(t,s),m=o??a??l;return e.createElement("time",{...i,ref:u,dateTime:c,"aria-label":m},l)});V.displayName="RelativeTime";var X=e.forwardRef(function({value:t,locale:n,format:r,variant:o,srLabel:a,"aria-label":i,...u},s){const d=S(t),l=A(d,{mode:"bangla",...{...void 0!==n&&{locale:n},...void 0!==r&&{format:r},...void 0!==o&&{variant:o}}}),c=G(t,d),m=a??i??l;return e.createElement("time",{...u,ref:s,dateTime:c,"aria-label":m},l)});X.displayName="BanglaDate";var _=e.forwardRef(function({value:t,locale:n,timeZone:r,srLabel:o,"aria-label":a,...i},u){const s=S(t),d=A(s,{mode:"hijri",...{...void 0!==n&&{locale:n},...void 0!==r&&{timeZone:r}}}),l=G(t,s),c=o??a??d;return e.createElement("time",{...i,ref:u,dateTime:l,"aria-label":c},d)});_.displayName="HijriDate",Q.Relative=V,Q.Bangla=X,Q.Hijri=_,exports.Tarikh=Q;
|
|
2
|
+
"use strict";var e=require("react"),t=["0","1","2","3","4","5","6","7","8","9"],n=["০","১","২","৩","৪","৫","৬","৭","৮","৯"],r=["January","February","March","April","May","June","July","August","September","October","November","December"],o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],a=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],u=["জানুয়ারি","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],s=["জানু","ফেব্রু","মার্চ","এপ্রি","মে","জুন","জুলা","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],d=["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"],l=["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],c=["বৈশাখ","জ্যৈষ্ঠ","আষাঢ়","শ্রাবণ","ভাদ্র","আশ্বিন","কার্তিক","অগ্রহায়ণ","পৌষ","মাঘ","ফাল্গুন","চৈত্র"],m=["Baishakh","Jaishtho","Asharh","Shrabon","Bhadro","Ashshin","Kartik","Agrahayan","Poush","Magh","Falgun","Chaitra"],h=[31,31,31,31,31,30,30,30,30,30,30,30],g={second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",day:"day",days:"days",week:"week",weeks:"weeks",month:"month",months:"months",year:"year",years:"years",ago:"ago",in:"in",justNow:"just now"},f={second:"সেকেন্ড",seconds:"সেকেন্ড",minute:"মিনিট",minutes:"মিনিট",hour:"ঘণ্টা",hours:"ঘণ্টা",day:"দিন",days:"দিন",week:"সপ্তাহ",weeks:"সপ্তাহ",month:"মাস",months:"মাস",year:"বছর",years:"বছর",ago:"আগে",in:"",justNow:"এইমাত্র"};function y(e){return String(e).replace(/\d/g,e=>n[Number(e)]??e)}function b(e){return String(e).replace(/[০-৯]/g,e=>{const r=n.indexOf(e);return r>=0?t[r]??e:e})}var p={jan:0,"jan.":0,january:0,"january,":0,feb:1,"feb.":1,february:1,"february,":1,mar:2,"mar.":2,march:2,"march,":2,apr:3,"apr.":3,april:3,"april,":3,may:4,"may,":4,jun:5,"jun.":5,june:5,"june,":5,jul:6,"jul.":6,july:6,"july,":6,aug:7,"aug.":7,august:7,"august,":7,sep:8,sept:8,"sep.":8,"sept.":8,september:8,"september,":8,oct:9,"oct.":9,october:9,"october,":9,nov:10,"nov.":10,november:10,"november,":10,dec:11,"dec.":11,december:11,"december,":11,"জানুয়ারি":0,"জানুয়ারি":0,"ফেব্রুয়ারি":1,"ফেব্রুয়ারি":1,"মার্চ":2,"এপ্রিল":3,"মে":4,"জুন":5,"জুলাই":6,"আগস্ট":7,"অগাস্ট":7,"সেপ্টেম্বর":8,"সেপ্টেম্বার":8,"অক্টোবর":9,"নভেম্বর":10,"নভেম্বার":10,"ডিসেম্বর":11,"ডিসেম্বার":11};function v(e){const t=e.trim(),n=t.toLowerCase(),i=p[n];if(void 0!==i)return i;for(let e=0;e<r.length;e++)if(r[e].toLowerCase()===n)return e;for(let e=0;e<o.length;e++)if(o[e].toLowerCase()===n)return e;for(let e=0;e<u.length;e++)if(u[e]===t)return e;for(let e=0;e<s.length;e++)if(s[e]===t)return e;return-1}function w(e){return Number.isFinite(e)&&Math.abs(e)<=864e13}function $(e,t,n,r=0,o=0,i=0,a=0){const u=new Date(0);return u.setUTCFullYear(e,t,n),u.setUTCHours(r,o,i,a),u.getUTCFullYear()!==e||u.getUTCMonth()!==t||u.getUTCDate()!==n||u.getUTCHours()!==r||u.getUTCMinutes()!==o||u.getUTCSeconds()!==i||u.getUTCMilliseconds()!==a?null:u}function D(e,t,n,r=0,o=0,i=0,a=0){return function(e,t,n,r=0,o=0,i=0,a=0){const u=new Date(0);return u.setFullYear(e,t,n),u.setHours(r,o,i,a),u.getFullYear()!==e||u.getMonth()!==t||u.getDate()!==n||u.getHours()!==r||u.getMinutes()!==o||u.getSeconds()!==i||u.getMilliseconds()!==a?null:u}(e,t,n,r,o,i,a)??$(e,t,n,r,o,i,a)}function S(e){if(!/^[+-]?\d+$/.test(e))return null;const t=Number(e);return Number.isInteger(t)?t:null}function M(e){return function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})([-/.])(\d{1,2})\2(\d{1,2})$/);return t?D(Number(t[1]),Number(t[3])-1,Number(t[4])):null}(e)??function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:?\d{2})?)$/);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),o=Number(t[3]),i=Number(t[4]??0),a=Number(t[5]??0),u=Number(t[6]??0),s=Number((t[7]??"0").padEnd(3,"0").slice(0,3)),d=t[8];if(void 0===d)return D(n,r-1,o,i,a,u,s);const l=d.match(/^([+-])(\d{2}):?(\d{2})$/),c=l?Number(l[2]):null,m=l?Number(l[3]):null,h="Z"===d?0:l&&null!==c&&null!==m&&c<=23&&m<=59?("+"===l[1]?1:-1)*(60*c+m):null;if(null===h)return null;const g=$(n,r-1,o,i,a,u,s);if(!g)return null;const f=g.getTime()-6e4*h;if(!w(f))return null;const y=new Date(f),b=new Date(f+6e4*h);return b.getUTCFullYear()!==n||b.getUTCMonth()!==r-1||b.getUTCDate()!==o||b.getUTCHours()!==i||b.getUTCMinutes()!==a||b.getUTCSeconds()!==u||b.getUTCMilliseconds()!==s?null:y}(e)??function(e){const t=e.match(/^(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:\s+|-)(\S+)(?:\s+|-)([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=Number(t[1]),r=t[2].replace(/,$/,""),o=t[3],i=v(r);if(-1===i)return null;const a=S(o);if(null===a)return null;let u=a;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),D(u,i,n)}(e)??function(e){const t=e.match(/^(\S+)\s+(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:,)?\s+([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=t[1].replace(/,$/,""),r=Number(t[2]),o=t[3],i=v(n);if(-1===i)return null;const a=S(o);if(null===a)return null;let u=a;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),D(u,i,r)}(e)}function N(e,t,n){if(!w(e.getTime())){throw new RangeError(`${"Date input"} is outside the supported range: ${String(t)}`)}return e}function T(e){if(e instanceof Date){const t=e.getTime();if(Number.isNaN(t))throw new Error(`Invalid date input: ${String(e)}`);return N(new Date(t),e)}if("number"==typeof e){if(!Number.isFinite(e))throw new Error(`Invalid date input: ${String(e)}`);const t=new Date(e);if(Number.isNaN(t.getTime())){if(!w(e))throw new RangeError(`Date input is outside the supported range: ${String(e)}`);throw new Error(`Invalid date input: ${String(e)}`)}return N(t,e)}const t=M(b(e).trim());if(!t)throw new Error(`Invalid date input: ${String(e)}`);return N(t,e)}function j(e,t){const n=T(e),r=n.getFullYear(),o=n.getMonth(),i=n.getDate(),a=new Date(r,3,14),u=o<3||3===o&&i<14,s=u?r-594:r-593,d=function(e,t){const n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.floor((r-n)/864e5)}(u?new Date(r-1,3,14):a,n)+1,l=function(e){const t=[...h];return function(e){return(t=e+594)%4==0&&t%100!=0||t%400==0;var t}(e)&&(t[10]=31),t}(s);let c=d,g=0;for(let e=0;e<l.length;e++){const t=l[e];if(c<=t){g=e;break}c-=t}return{day:c,month:m[g],monthIndex:g+1,year:s}}var k=["Asia/Dhaka","UTC"],F={locale:"en-BD",mode:"standard",month:void 0,timeZone:"Asia/Dhaka",hijriSystem:"islamic-umalqura"};function Y(){return{...F}}function B(e,t){const n=e.find(e=>e.type===t);if(void 0===n)throw new Error(`Missing ${t} part while formatting Hijri date.`);return n.value}function C(e,t){const n=Y(),r=t?.locale??"en-BD",o=t?.timeZone??n.timeZone,i=t?.hijriSystem??n.hijriSystem;!function(e){if(!k.includes(e))throw new RangeError(`Unsupported Hijri time zone: ${e}. Supported values: ${k.join(", ")}`)}(o),function(e){if(!["islamic-umalqura","islamic-civil"].includes(e))throw new RangeError(`Unsupported Hijri calendar system: ${e}. Supported values: islamic-umalqura, islamic-civil`)}(i);const a=function(e,t,n,r){const o=function(e,t){return`${e}-u-ca-${t}`}(t,r),i=new Intl.DateTimeFormat(o,{day:"numeric",month:"numeric",year:"numeric",timeZone:n}).formatToParts(e),a=new Intl.DateTimeFormat(o,{day:"numeric",month:"long",year:"numeric",timeZone:n}).formatToParts(e);return{day:B(i,"day"),month:B(a,"month"),monthIndex:Number(b(B(i,"month"))),year:B(i,"year")}}(T(e),r,o,i);return"bn-BD"===r?{day:y(a.day),month:a.month,monthIndex:a.monthIndex,year:y(a.year)}:{day:Number(b(a.day)),month:a.month,monthIndex:a.monthIndex,year:Number(b(a.year))}}function I(e){const t=y(e);return 1===e?`${t}লা`:2===e||3===e?`${t}রা`:4===e?`${t}ঠা`:e>=19?`${t}শে`:`${t}ই`}function H(e){const t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function U(e,t){return"spoken"===(t?.format??"ordinal")?function(e,t="pohela"){switch(e){case 1:return"poyla"===t?"পয়লা":"পহেলা";case 2:return"দোসরা";case 3:return"তেসরা";case 4:return"চৌঠা";default:return I(e)}}(e,t?.variant):I(e)}function E(e,t){return"2-digit"===t?String(e).padStart(2,"0"):String(e)}function Z(e,t,n){const r=E(e,n);return"bn-BD"===t?y(r):r}function x(e,t,n){if(!t.includes(e))throw new TypeError(`Invalid ${n}: ${e}`)}function A(e,t,n){if("bn-BD"===t)return e<12?"পূর্বাহ্ণ":"অপরাহ্ণ";const r=e<12?"AM":"PM";return n?r.toLowerCase():r}function _(e,t){const n=T(e),r=`${o=n.getFullYear(),o>=0&&o<=9999?String(o).padStart(4,"0"):`${o>=0?"+":"-"}${String(Math.abs(o)).padStart(6,"0")}`}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")} ${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}:${String(n.getSeconds()).padStart(2,"0")}`;var o;return"bn-BD"===t?y(r):r}function R(e,t){if(void 0!==t&&(null===t||"object"!=typeof t||Array.isArray(t)))throw new TypeError("format() expects an options object");const n=Y();if(t&&"pattern"in t&&void 0!==t.pattern){if("mode"in t&&void 0!==t.mode)throw new TypeError("Do not pass `mode` when `pattern` is provided. `pattern` formatting does not use mode.");const c=t.locale??n.locale;return function(e,t,n="en-BD"){const c=T(e),m="bn-BD"===n,h=c.getDate(),g=c.getMonth(),f=c.getFullYear(),y=m?u:r,b=m?s:o,p=m?d:i,v=m?l:a,w=c.getHours(),$=w%12||12,D={dddd:p[c.getDay()],ddd:v[c.getDay()],MMMM:y[g],MMM:b[g],MM:Z(g+1,n,"2-digit"),M:Z(g+1,n,"numeric"),DD:Z(h,n,"2-digit"),D:Z(h,n,"numeric"),HH:Z(w,n,"2-digit"),H:Z(w,n,"numeric"),hh:Z($,n,"2-digit"),h:Z($,n,"numeric"),mm:Z(c.getMinutes(),n,"2-digit"),m:Z(c.getMinutes(),n,"numeric"),ss:Z(c.getSeconds(),n,"2-digit"),s:Z(c.getSeconds(),n,"numeric"),A:A(w,n,!1),a:A(w,n,!0),YYYY:Z(f,n,"numeric"),YY:Z(Number(String(f).slice(-2)),n,"2-digit")},S=/dddd|ddd|MMMM|MMM|MM|M|DD|D|YYYY|YY|HH|H|hh|h|mm|m|ss|s|A|a/g,M=e=>e.replace(S,e=>D[e]);let N="",j=0;for(;j<t.length;){const e=t.indexOf("[",j);if(-1===e){N+=M(t.slice(j));break}N+=M(t.slice(j,e));const n=t.indexOf("]",e+1);if(-1===n){N+=t.slice(e);break}N+=t.slice(e+1,n),j=n+1}return N}(e,t.pattern,c)}const m=function(e,t){if(void 0===e)return t;if("mode"in e&&void 0!==e.mode)return e.mode;const n=e;return"digits"in n||"monthFormat"in n||"en"===n.month||"bn"===n.month||"en"===n.year||"bn"===n.year||"en"===n.day||"bn"===n.day?"hybrid":"timeZone"in n||"hijriSystem"in n?"hijri":"format"in n||"variant"in n?"bangla":"weekday"in n||"hour"in n||"minute"in n||"second"in n||"hour12"in n||"preset"in n||"short"===n.month||"long"===n.month||"numeric"===n.year||"2-digit"===n.year||"numeric"===n.day||"2-digit"===n.day?"standard":t}(t,n.mode);switch(m){case"standard":return function(e,t){const n=Y(),c=t?.locale??n.locale;if("isoLike"===t?.preset)return _(e,c);const m=function(e){return"dateTime"===e?.preset?{hour:"2-digit",minute:"2-digit",...e}:e??{}}(t),h=T(e),g=m.month??n.month??("bn-BD"===c?"long":"short"),f=m.year??"numeric",b=m.day??"numeric",p=m.weekday,v=m.hour,w=m.minute,$=m.second,D=void 0!==v||void 0!==w||void 0!==$,S="bn-BD"===c;x(g,["short","long"],"month format for standard mode"),x(f,["numeric","2-digit"],"year format for standard mode"),x(b,["numeric","2-digit"],"day format for standard mode"),void 0!==p&&x(p,["short","long"],"weekday format for standard mode"),void 0!==v&&x(v,["numeric","2-digit"],"hour format for standard mode"),void 0!==w&&x(w,["numeric","2-digit"],"minute format for standard mode"),void 0!==$&&x($,["numeric","2-digit"],"second format for standard mode");const M=h.getDate(),N=h.getMonth(),j=h.getFullYear(),k=S?" খ্রিস্টাব্দ":"",F=`${"2-digit"===b?String(M).padStart(2,"0"):S?I(M):H(M)} ${(S?"short"===g?s:u:"short"===g?o:r)[N]} ${"2-digit"===f?String(j).slice(-2):String(j)}${k}`,B=void 0!==p?`${(S?"short"===p?l:d:"short"===p?a:i)[h.getDay()]}, `:"";let C="";if(D){const e=m.hour12??!1,t=h.getHours(),n=w??(void 0!==$?"2-digit":void 0);C=`${E(e?t%12||12:t,v??"numeric")}${void 0!==n?`:${E(h.getMinutes(),n)}`:""}${void 0!==$?`:${E(h.getSeconds(),$)}`:""}${e?` ${A(t,c,!1)}`:""}`}const U=`${B}${F}${C?`, ${C}`:""}`;return S?y(U):U}(e,t);case"bangla":return function(e,t){const n=t?.locale??Y().locale,r=t?.format??"ordinal",o=t?.variant,i=j(e);if("bn-BD"===n){const e=i.monthIndex-1,t={format:r};return void 0!==o&&(t.variant=o),`${U(i.day,t)} ${c[e]} ${y(i.year)} বঙ্গাব্দ`}return`${H(i.day)} ${i.month} ${i.year}`}(e,t);case"hijri":return function(e,t){const n=t?.locale??Y().locale;if("bn-BD"===n){const n=C(e,{locale:"bn-BD",...void 0!==t?.timeZone&&{timeZone:t.timeZone},...void 0!==t?.hijriSystem&&{hijriSystem:t.hijriSystem}}),r=y(n.year);return`${function(e){const t=y(e);return 1===e?`${t}লা`:2===e?`${t}রা`:`${t}ই`}(Number(b(n.day)))} ${n.month} ${r} হিজরি`}const r=C(e,{locale:"en-BD",...void 0!==t?.timeZone&&{timeZone:t.timeZone},...void 0!==t?.hijriSystem&&{hijriSystem:t.hijriSystem}});return`${H(r.day)} ${r.month} ${r.year} AH`}(e,t);case"hybrid":return function(e,t){const n=T(e),i=t?.digits??"en",a=t?.month??"bn",d=t?.year??"en",l=t?.day??i,c=t?.monthFormat??"long";x(i,["en","bn"],"digits language for hybrid mode"),x(a,["en","bn"],"month language for hybrid mode"),x(d,["en","bn"],"year language for hybrid mode"),x(l,["en","bn"],"day language for hybrid mode"),x(c,["short","long"],"month format for hybrid mode");const m=n.getDate(),h=n.getMonth(),g=n.getFullYear(),f="bn"===a?"short"===c?s:u:"short"===c?o:r,b="bn"===l?y(m):String(m),p=f[h],v="bn"===d?y(g):String(g);return`${b} ${p} ${v}`}(e,t);default:throw new TypeError(`Invalid format mode: ${String(m)}`)}}var L=/^([+-]\d{6}|\d{4})([-/.])(\d{1,2})\2(\d{1,2})$/,J=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:?\d{2})?)$/,O=/^(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:\s+|-)(\S+)(?:\s+|-)([+-]\d{6}|\d{4}|\d{2})$/i,W=/^(\S+)\s+(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:,)?\s+([+-]\d{6}|\d{4}|\d{2})$/i;function q(e,t,n,r,o,i){return{success:!0,input:e,normalizedInput:t,calendar:n,strict:r,format:o,date:i}}function P(e,t,n,r,o,i){return{success:!1,input:e,normalizedInput:t,calendar:n,strict:r,reason:o,message:i,date:null}}function z(e,t,n){const r=function(e){if(L.test(e))return"ymd";if(J.test(e))return"iso_datetime";const t=e.match(O);if(t&&-1!==v(t[2].replace(/,$/,"")))return"day_month_year";const n=e.match(W);return n&&-1!==v(n[1].replace(/,$/,""))?"month_day_year":null}(t);if(null===r)return P(e,t,"gregorian",n,"invalid_string","Input does not match a supported Gregorian date format.");const o=M(t);return null===o?P(e,t,"gregorian",n,"invalid_string","Input matches a Gregorian date shape but is not a valid calendar date."):q(e,t,"gregorian",n,r,o)}function G(e,t){const n=function(e){const t="gregorian",n=!1;if(e instanceof Date)return Number.isNaN(e.getTime())?P(e,null,t,n,"invalid_date_object","Date object is invalid."):q(e,null,t,n,"date_object",new Date(e.getTime()));if("number"==typeof e){if(!Number.isFinite(e))return P(e,e,t,n,"invalid_timestamp","Timestamp is invalid.");const r=new Date(e);if(Number.isNaN(r.getTime())){const r=Math.abs(e)>864e13;return P(e,e,t,n,r?"out_of_range":"invalid_timestamp",r?"Timestamp is outside the supported Date range.":"Timestamp is invalid.")}return q(e,e,t,n,"timestamp",r)}const r=b(e).trim();return 0===r.length?P(e,r,t,n,"invalid_string","Input is empty."):z(e,r,n)}(e);return n.success?n.date:null}var K=1e3,Q=36e5,V=24*Q,X={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",week:"wk",weeks:"wk",month:"mo",months:"mo",year:"y",years:"y",ago:"ago",in:"in",justNow:"now"},ee={second:"সে.",seconds:"সে.",minute:"মি.",minutes:"মি.",hour:"ঘ.",hours:"ঘ.",day:"দিন",days:"দিন",week:"সপ্তা.",weeks:"সপ্তা.",month:"মাস",months:"মাস",year:"বছ.",years:"বছ.",ago:"আগে",in:"",justNow:"এখন"},te={justNow:K,minute:6e4,hour:Q,day:V,week:7*V,month:30*V,year:365*V};function ne(e,t){return new Date(e,t+1,0).getDate()}function re(e,t){let n=e.getFullYear()-t.getFullYear();const r=function(e,t){const n=e.getFullYear()+t,r=e.getMonth(),o=Math.min(e.getDate(),ne(n,r));return new Date(n,r,o,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function oe(e,t){let n=12*(e.getFullYear()-t.getFullYear())+(e.getMonth()-t.getMonth());const r=function(e,t){const n=e.getFullYear(),r=e.getMonth()+t,o=n+Math.floor(r/12),i=(r%12+12)%12,a=Math.min(e.getDate(),ne(o,i));return new Date(o,i,a,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function ie(e,t){if(!Number.isFinite(e)||e<0)throw new RangeError(`Invalid relative time threshold for ${t}: ${e}`)}function ae(e,t,n,r,o,i){const a="bn-BD"===o,u=a?y(e):String(e),s=1===e?t:n,d="short"===i&&"en-BD"===o?`${u}${s}`:`${u} ${s}`;return a?r?`${d} আগে`:`${d} পরে`:r?`${d} ago`:`in ${d}`}function ue(e,t,n){return"bn-BD"===n?"day"===e?t?"গতকাল":"আগামীকাল":"week"===e?t?"গত সপ্তাহে":"আগামী সপ্তাহে":"month"===e?t?"গত মাসে":"আগামী মাসে":t?"গত বছর":"আগামী বছর":"day"===e?t?"yesterday":"tomorrow":"week"===e?t?"last week":"next week":"month"===e?t?"last month":"next month":t?"last year":"next year"}function se(e,t){const n=Y(),r=T(e),o=t?.locale??n.locale,i=t?.numeric??"always",a=t?.style??"long",u=function(e){const t={...te,...e};ie(t.justNow,"justNow"),ie(t.minute,"minute"),ie(t.hour,"hour"),ie(t.day,"day"),ie(t.week,"week"),ie(t.month,"month"),ie(t.year,"year");const n=[t.justNow,t.minute,t.hour,t.day,t.week,t.month,t.year];for(let e=1;e<n.length;e+=1)if(n[e]<n[e-1])throw new RangeError("Relative time thresholds must be non-decreasing from justNow to year");return t}(t?.threshold),s=void 0===t?.baseDate?new Date:T(t.baseDate),d=function(e,t){return"short"===t?"bn-BD"===e?ee:X:"bn-BD"===e?f:g}(o,a),l=s.getTime()-r.getTime(),c=Math.abs(l),m=l>0,h=m?s:r,y=m?r:s;if(c<u.justNow)return d.justNow;if("auto"===i&&(p=s,(b=r).getFullYear()===p.getFullYear()&&b.getMonth()===p.getMonth()&&b.getDate()===p.getDate()))return function(e){return"bn-BD"===e?"আজ":"today"}(o);var b,p;const v=re(h,y);if(v>=1&&c>=u.year){if("auto"===i&&1===v){const e=ue("year",m,o);if(null!==e)return e}return ae(v,d.year,d.years,m,o,a)}const w=oe(h,y);if(w>=1&&c>=u.month){if("auto"===i&&1===w){const e=ue("month",m,o);if(null!==e)return e}return ae(w,d.month,d.months,m,o,a)}const $=[{threshold:u.week,singular:"week",plural:"weeks"},{threshold:u.day,singular:"day",plural:"days"},{threshold:u.hour,singular:"hour",plural:"hours"},{threshold:u.minute,singular:"minute",plural:"minutes"},{threshold:K,singular:"second",plural:"seconds"}];for(const e of $)if(c>=e.threshold){const t=Math.floor(c/e.threshold);if("auto"===i&&1===t&&("day"===e.singular||"week"===e.singular)){const t=ue(e.singular,m,o);if(null!==t)return t}return ae(t,d[e.singular],d[e.plural],m,o,a)}return d.justNow}function de(e,t){return function(e){return"string"==typeof e&&!/(?:T|\s)\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/i.test(e.trim())&&null!==G(e)}(e)?function(e){return`${String(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}(t):t.toISOString()}var le=e.forwardRef(function({value:t,locale:n,preset:r,month:o,year:i,day:a,weekday:u,hour:s,minute:d,second:l,hour12:c,srLabel:m,"aria-label":h,...g},f){const y=T(t),b=R(y,{mode:"standard",...{...void 0!==n&&{locale:n},...void 0!==r&&{preset:r},...void 0!==o&&{month:o},...void 0!==i&&{year:i},...void 0!==a&&{day:a},...void 0!==u&&{weekday:u},...void 0!==s&&{hour:s},...void 0!==d&&{minute:d},...void 0!==l&&{second:l},...void 0!==c&&{hour12:c}}}),p=de(t,y),v=m??h??b;return e.createElement("time",{...g,ref:f,dateTime:p,"aria-label":v},b)});le.displayName="Tarikh";var ce=e.forwardRef(function({value:t,locale:n,numeric:r,baseDate:o,relativeStyle:i,threshold:a,srLabel:u,"aria-label":s,...d},l){const c=T(t),m={...void 0!==n&&{locale:n},...void 0!==r&&{numeric:r},...void 0!==o&&{baseDate:o},...void 0!==i&&{style:i},...void 0!==a&&{threshold:a}},h=se(c,Object.keys(m).length>0?m:void 0),g=de(t,c),f=u??s??h;return e.createElement("time",{...d,ref:l,dateTime:g,"aria-label":f},h)});ce.displayName="RelativeTime";var me=e.forwardRef(function({value:t,locale:n,format:r,variant:o,srLabel:i,"aria-label":a,...u},s){const d=T(t),l=R(d,{mode:"bangla",...{...void 0!==n&&{locale:n},...void 0!==r&&{format:r},...void 0!==o&&{variant:o}}}),c=de(t,d),m=i??a??l;return e.createElement("time",{...u,ref:s,dateTime:c,"aria-label":m},l)});me.displayName="BanglaDate";var he=e.forwardRef(function({value:t,locale:n,timeZone:r,hijriSystem:o,srLabel:i,"aria-label":a,...u},s){const d=T(t),l=R(d,{mode:"hijri",...{...void 0!==n&&{locale:n},...void 0!==r&&{timeZone:r},...void 0!==o&&{hijriSystem:o}}}),c=de(t,d),m=i??a??l;return e.createElement("time",{...u,ref:s,dateTime:c,"aria-label":m},l)});he.displayName="HijriDate",le.Relative=ce,le.Bangla=me,le.Hijri=he,exports.Tarikh=le;
|
package/dist/react.d.cts
CHANGED
|
@@ -6,6 +6,8 @@ type YearFormat = "numeric" | "2-digit";
|
|
|
6
6
|
type DayFormat = "numeric" | "2-digit";
|
|
7
7
|
type WeekdayFormat = "short" | "long";
|
|
8
8
|
type TimeFormat = "numeric" | "2-digit";
|
|
9
|
+
type StandardFormatPreset = "date" | "dateTime" | "isoLike";
|
|
10
|
+
type HijriCalendarSystem = "islamic-umalqura" | "islamic-civil";
|
|
9
11
|
declare const HIJRI_TIME_ZONES: readonly ["Asia/Dhaka", "UTC"];
|
|
10
12
|
type HijriTimeZone = (typeof HIJRI_TIME_ZONES)[number];
|
|
11
13
|
type DateInput = Date | string | number;
|
|
@@ -19,10 +21,24 @@ interface DateFormatOptions {
|
|
|
19
21
|
minute?: TimeFormat;
|
|
20
22
|
second?: TimeFormat;
|
|
21
23
|
hour12?: boolean;
|
|
24
|
+
preset?: StandardFormatPreset;
|
|
25
|
+
}
|
|
26
|
+
type RelativeTimeStyle = "long" | "short";
|
|
27
|
+
interface RelativeTimeThresholdOptions {
|
|
28
|
+
justNow?: number;
|
|
29
|
+
minute?: number;
|
|
30
|
+
hour?: number;
|
|
31
|
+
day?: number;
|
|
32
|
+
week?: number;
|
|
33
|
+
month?: number;
|
|
34
|
+
year?: number;
|
|
22
35
|
}
|
|
23
36
|
interface RelativeTimeOptions {
|
|
24
37
|
locale?: Locale;
|
|
25
38
|
numeric?: "always" | "auto";
|
|
39
|
+
baseDate?: DateInput;
|
|
40
|
+
style?: RelativeTimeStyle;
|
|
41
|
+
threshold?: RelativeTimeThresholdOptions;
|
|
26
42
|
}
|
|
27
43
|
type BanglaCalendarDayFormat = "ordinal" | "spoken";
|
|
28
44
|
type BanglaCalendarDaySpokenVariant = "pohela" | "poyla";
|
|
@@ -36,6 +52,9 @@ interface RelativeTimeProps extends Omit<ComponentPropsWithoutRef<"time">, "chil
|
|
|
36
52
|
value: DateInput;
|
|
37
53
|
locale?: Locale;
|
|
38
54
|
numeric?: RelativeTimeOptions["numeric"];
|
|
55
|
+
baseDate?: RelativeTimeOptions["baseDate"];
|
|
56
|
+
relativeStyle?: RelativeTimeOptions["style"];
|
|
57
|
+
threshold?: RelativeTimeOptions["threshold"];
|
|
39
58
|
srLabel?: string;
|
|
40
59
|
}
|
|
41
60
|
interface BanglaDateProps extends Omit<ComponentPropsWithoutRef<"time">, "children"> {
|
|
@@ -49,6 +68,7 @@ interface HijriDateProps extends Omit<ComponentPropsWithoutRef<"time">, "childre
|
|
|
49
68
|
value: DateInput;
|
|
50
69
|
locale?: Locale;
|
|
51
70
|
timeZone?: HijriTimeZone;
|
|
71
|
+
hijriSystem?: HijriCalendarSystem;
|
|
52
72
|
srLabel?: string;
|
|
53
73
|
}
|
|
54
74
|
|
package/dist/react.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ type YearFormat = "numeric" | "2-digit";
|
|
|
6
6
|
type DayFormat = "numeric" | "2-digit";
|
|
7
7
|
type WeekdayFormat = "short" | "long";
|
|
8
8
|
type TimeFormat = "numeric" | "2-digit";
|
|
9
|
+
type StandardFormatPreset = "date" | "dateTime" | "isoLike";
|
|
10
|
+
type HijriCalendarSystem = "islamic-umalqura" | "islamic-civil";
|
|
9
11
|
declare const HIJRI_TIME_ZONES: readonly ["Asia/Dhaka", "UTC"];
|
|
10
12
|
type HijriTimeZone = (typeof HIJRI_TIME_ZONES)[number];
|
|
11
13
|
type DateInput = Date | string | number;
|
|
@@ -19,10 +21,24 @@ interface DateFormatOptions {
|
|
|
19
21
|
minute?: TimeFormat;
|
|
20
22
|
second?: TimeFormat;
|
|
21
23
|
hour12?: boolean;
|
|
24
|
+
preset?: StandardFormatPreset;
|
|
25
|
+
}
|
|
26
|
+
type RelativeTimeStyle = "long" | "short";
|
|
27
|
+
interface RelativeTimeThresholdOptions {
|
|
28
|
+
justNow?: number;
|
|
29
|
+
minute?: number;
|
|
30
|
+
hour?: number;
|
|
31
|
+
day?: number;
|
|
32
|
+
week?: number;
|
|
33
|
+
month?: number;
|
|
34
|
+
year?: number;
|
|
22
35
|
}
|
|
23
36
|
interface RelativeTimeOptions {
|
|
24
37
|
locale?: Locale;
|
|
25
38
|
numeric?: "always" | "auto";
|
|
39
|
+
baseDate?: DateInput;
|
|
40
|
+
style?: RelativeTimeStyle;
|
|
41
|
+
threshold?: RelativeTimeThresholdOptions;
|
|
26
42
|
}
|
|
27
43
|
type BanglaCalendarDayFormat = "ordinal" | "spoken";
|
|
28
44
|
type BanglaCalendarDaySpokenVariant = "pohela" | "poyla";
|
|
@@ -36,6 +52,9 @@ interface RelativeTimeProps extends Omit<ComponentPropsWithoutRef<"time">, "chil
|
|
|
36
52
|
value: DateInput;
|
|
37
53
|
locale?: Locale;
|
|
38
54
|
numeric?: RelativeTimeOptions["numeric"];
|
|
55
|
+
baseDate?: RelativeTimeOptions["baseDate"];
|
|
56
|
+
relativeStyle?: RelativeTimeOptions["style"];
|
|
57
|
+
threshold?: RelativeTimeOptions["threshold"];
|
|
39
58
|
srLabel?: string;
|
|
40
59
|
}
|
|
41
60
|
interface BanglaDateProps extends Omit<ComponentPropsWithoutRef<"time">, "children"> {
|
|
@@ -49,6 +68,7 @@ interface HijriDateProps extends Omit<ComponentPropsWithoutRef<"time">, "childre
|
|
|
49
68
|
value: DateInput;
|
|
50
69
|
locale?: Locale;
|
|
51
70
|
timeZone?: HijriTimeZone;
|
|
71
|
+
hijriSystem?: HijriCalendarSystem;
|
|
52
72
|
srLabel?: string;
|
|
53
73
|
}
|
|
54
74
|
|
package/dist/react.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{forwardRef as e,createElement as t}from"react";var n=["0","1","2","3","4","5","6","7","8","9"],r=["০","১","২","৩","৪","৫","৬","৭","৮","৯"],o=["January","February","March","April","May","June","July","August","September","October","November","December"],a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s=["জানুয়ারি","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],d=["জানু","ফেব্রু","মার্চ","এপ্রি","মে","জুন","জুলা","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],l=["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"],c=["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],m=["বৈশাখ","জ্যৈষ্ঠ","আষাঢ়","শ্রাবণ","ভাদ্র","আশ্বিন","কার্তিক","অগ্রহায়ণ","পৌষ","মাঘ","ফাল্গুন","চৈত্র"],g=["Baishakh","Jaishtho","Asharh","Shrabon","Bhadro","Ashshin","Kartik","Agrahayan","Poush","Magh","Falgun","Chaitra"],h=[31,31,31,31,31,30,30,30,30,30,30,30],f={second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",day:"day",days:"days",week:"week",weeks:"weeks",month:"month",months:"months",year:"year",years:"years",ago:"ago",in:"in",justNow:"just now"},y={second:"সেকেন্ড",seconds:"সেকেন্ড",minute:"মিনিট",minutes:"মিনিট",hour:"ঘণ্টা",hours:"ঘণ্টা",day:"দিন",days:"দিন",week:"সপ্তাহ",weeks:"সপ্তাহ",month:"মাস",months:"মাস",year:"বছর",years:"বছর",ago:"আগে",in:"",justNow:"এইমাত্র"};function b(e){return String(e).replace(/\d/g,e=>r[Number(e)]??e)}function $(e){return String(e).replace(/[০-৯]/g,e=>{const t=r.indexOf(e);return t>=0?n[t]??e:e})}var w={jan:0,"jan.":0,january:0,"january,":0,feb:1,"feb.":1,february:1,"february,":1,mar:2,"mar.":2,march:2,"march,":2,apr:3,"apr.":3,april:3,"april,":3,may:4,"may,":4,jun:5,"jun.":5,june:5,"june,":5,jul:6,"jul.":6,july:6,"july,":6,aug:7,"aug.":7,august:7,"august,":7,sep:8,sept:8,"sep.":8,"sept.":8,september:8,"september,":8,oct:9,"oct.":9,october:9,"october,":9,nov:10,"nov.":10,november:10,"november,":10,dec:11,"dec.":11,december:11,"december,":11,"জানুয়ারি":0,"জানুয়ারি":0,"ফেব্রুয়ারি":1,"ফেব্রুয়ারি":1,"মার্চ":2,"এপ্রিল":3,"মে":4,"জুন":5,"জুলাই":6,"আগস্ট":7,"অগাস্ট":7,"সেপ্টেম্বর":8,"সেপ্টেম্বার":8,"অক্টোবর":9,"নভেম্বর":10,"নভেম্বার":10,"ডিসেম্বর":11,"ডিসেম্বার":11,"জানু":0,"ফেব্রু":1,"এপ্রি":3,"জুলা":6,"আগ":7,"সেপ্টে":8,"অক্টো":9,"নভে":10,"ডিসে":11};function p(e){const t=e.trim(),n=t.toLowerCase(),r=w[n];if(void 0!==r)return r;for(let e=0;e<o.length;e++)if(o[e].toLowerCase()===n)return e;for(let e=0;e<a.length;e++)if(a[e].toLowerCase()===n)return e;for(let e=0;e<s.length;e++)if(s[e]===t)return e;for(let e=0;e<d.length;e++)if(d[e]===t)return e;return-1}function v(e){return Number.isFinite(e)&&Math.abs(e)<=864e13}function D(e,t,n,r=0,o=0,a=0,i=0){const u=new Date(0);return u.setUTCFullYear(e,t,n),u.setUTCHours(r,o,a,i),u.getUTCFullYear()!==e||u.getUTCMonth()!==t||u.getUTCDate()!==n||u.getUTCHours()!==r||u.getUTCMinutes()!==o||u.getUTCSeconds()!==a||u.getUTCMilliseconds()!==i?null:u}function M(e,t,n,r=0,o=0,a=0,i=0){return function(e,t,n,r=0,o=0,a=0,i=0){const u=new Date(0);return u.setFullYear(e,t,n),u.setHours(r,o,a,i),u.getFullYear()!==e||u.getMonth()!==t||u.getDate()!==n||u.getHours()!==r||u.getMinutes()!==o||u.getSeconds()!==a||u.getMilliseconds()!==i?null:u}(e,t,n,r,o,a,i)??D(e,t,n,r,o,a,i)}function T(e){if(!/^[+-]?\d+$/.test(e))return null;const t=Number(e);return Number.isInteger(t)?t:null}function N(e){return function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})([-/.])(\d{1,2})\2(\d{1,2})$/);return t?M(Number(t[1]),Number(t[3])-1,Number(t[4])):null}(e)??function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:?\d{2})?)$/);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),o=Number(t[3]),a=Number(t[4]??0),i=Number(t[5]??0),u=Number(t[6]??0),s=Number((t[7]??"0").padEnd(3,"0").slice(0,3)),d=t[8];if(void 0===d)return M(n,r-1,o,a,i,u,s);const l=d.match(/^([+-])(\d{2}):?(\d{2})$/),c=l?Number(l[2]):null,m=l?Number(l[3]):null,g="Z"===d?0:l&&null!==c&&null!==m&&c<=23&&m<=59?("+"===l[1]?1:-1)*(60*c+m):null;if(null===g)return null;const h=D(n,r-1,o,a,i,u,s);if(!h)return null;const f=h.getTime()-6e4*g;if(!v(f))return null;const y=new Date(f),b=new Date(f+6e4*g);return b.getUTCFullYear()!==n||b.getUTCMonth()!==r-1||b.getUTCDate()!==o||b.getUTCHours()!==a||b.getUTCMinutes()!==i||b.getUTCSeconds()!==u||b.getUTCMilliseconds()!==s?null:y}(e)??function(e){const t=e.match(/^(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:\s+|-)(\S+)(?:\s+|-)([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=Number(t[1]),r=t[2].replace(/,$/,""),o=t[3],a=p(r);if(-1===a)return null;const i=T(o);if(null===i)return null;let u=i;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),M(u,a,n)}(e)??function(e){const t=e.match(/^(\S+)\s+(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:,)?\s+([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=t[1].replace(/,$/,""),r=Number(t[2]),o=t[3],a=p(n);if(-1===a)return null;const i=T(o);if(null===i)return null;let u=i;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),M(u,a,r)}(e)}function S(e,t,n){if(!v(e.getTime())){throw new RangeError(`${"Date input"} is outside the supported range: ${String(t)}`)}return e}function Y(e){if(e instanceof Date){const t=e.getTime();if(Number.isNaN(t))throw new Error(`Invalid date input: ${String(e)}`);return S(new Date(t),e)}if("number"==typeof e){if(!Number.isFinite(e))throw new Error(`Invalid date input: ${String(e)}`);const t=new Date(e);if(Number.isNaN(t.getTime())){if(!v(e))throw new RangeError(`Date input is outside the supported range: ${String(e)}`);throw new Error(`Invalid date input: ${String(e)}`)}return S(t,e)}const t=N($(e).trim());if(!t)throw new Error(`Invalid date input: ${String(e)}`);return S(t,e)}function F(e,t){const n=Y(e),r=n.getFullYear(),o=n.getMonth(),a=n.getDate(),i=new Date(r,3,14),u=o<3||3===o&&a<14,s=u?r-594:r-593,d=function(e,t){const n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.floor((r-n)/864e5)}(u?new Date(r-1,3,14):i,n)+1,l=function(e){const t=[...h];return function(e){return(t=e+594)%4==0&&t%100!=0||t%400==0;var t}(e)&&(t[10]=31),t}(s);let c=d,m=0;for(let e=0;e<l.length;e++){const t=l[e];if(c<=t){m=e;break}c-=t}return{day:c,month:g[m],monthIndex:m+1,year:s}}var j=["Asia/Dhaka","UTC"];function k(e,t){const n=e.find(e=>e.type===t);if(void 0===n)throw new Error(`Missing ${t} part while formatting Hijri date.`);return n.value}function C(e,t){const n=t?.locale??"en-BD",r=t?.timeZone??"Asia/Dhaka";!function(e){if(!j.includes(e))throw new RangeError(`Unsupported Hijri time zone: ${e}. Supported values: ${j.join(", ")}`)}(r);const o=function(e,t,n){const r=function(e){return`${e}-u-ca-islamic-umalqura`}(t),o=new Intl.DateTimeFormat(r,{day:"numeric",month:"numeric",year:"numeric",timeZone:n}).formatToParts(e),a=new Intl.DateTimeFormat(r,{day:"numeric",month:"long",year:"numeric",timeZone:n}).formatToParts(e);return{day:k(o,"day"),month:k(a,"month"),monthIndex:Number($(k(o,"month"))),year:k(o,"year")}}(Y(e),n,r);return"bn-BD"===n?{day:b(o.day),month:o.month,monthIndex:o.monthIndex,year:b(o.year)}:{day:Number($(o.day)),month:o.month,monthIndex:o.monthIndex,year:Number($(o.year))}}function B(e){const t=b(e);return 1===e?`${t}লা`:2===e||3===e?`${t}রা`:4===e?`${t}ঠা`:e>=19?`${t}শে`:`${t}ই`}function H(e){const t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function U(e,t){return"spoken"===(t?.format??"ordinal")?function(e,t="pohela"){switch(e){case 1:return"poyla"===t?"পয়লা":"পহেলা";case 2:return"দোসরা";case 3:return"তেসরা";case 4:return"চৌঠা";default:return B(e)}}(e,t?.variant):B(e)}function I(e,t){return"2-digit"===t?String(e).padStart(2,"0"):String(e)}function x(e,t,n){const r=I(e,n);return"bn-BD"===t?b(r):r}function A(e,t,n){if(!t.includes(e))throw new TypeError(`Invalid ${n}: ${e}`)}function E(e,t,n){if("bn-BD"===t)return e<12?"পূর্বাহ্ণ":"অপরাহ্ণ";const r=e<12?"AM":"PM";return n?r.toLowerCase():r}function Z(e,t){if(null===t||"object"!=typeof t||Array.isArray(t))throw new TypeError("format() expects an options object");if("pattern"in t&&void 0!==t.pattern){if("mode"in t&&void 0!==t.mode)throw new TypeError("Do not pass `mode` when `pattern` is provided. `pattern` formatting does not use mode.");const n="locale"in t&&void 0!==t.locale?t.locale:"en-BD";return function(e,t,n="en-BD"){const r=Y(e),m="bn-BD"===n,g=r.getDate(),h=r.getMonth(),f=r.getFullYear(),y=m?s:o,b=m?d:a,$=m?l:i,w=m?c:u,p=r.getHours(),v=p%12||12,D={dddd:$[r.getDay()],ddd:w[r.getDay()],MMMM:y[h],MMM:b[h],MM:x(h+1,n,"2-digit"),M:x(h+1,n,"numeric"),DD:x(g,n,"2-digit"),D:x(g,n,"numeric"),HH:x(p,n,"2-digit"),H:x(p,n,"numeric"),hh:x(v,n,"2-digit"),h:x(v,n,"numeric"),mm:x(r.getMinutes(),n,"2-digit"),m:x(r.getMinutes(),n,"numeric"),ss:x(r.getSeconds(),n,"2-digit"),s:x(r.getSeconds(),n,"numeric"),A:E(p,n,!1),a:E(p,n,!0),YYYY:x(f,n,"numeric"),YY:x(Number(String(f).slice(-2)),n,"2-digit")},M=/dddd|ddd|MMMM|MMM|MM|M|DD|D|YYYY|YY|HH|H|hh|h|mm|m|ss|s|A|a/g,T=e=>e.replace(M,e=>D[e]);let N="",S=0;for(;S<t.length;){const e=t.indexOf("[",S);if(-1===e){N+=T(t.slice(S));break}N+=T(t.slice(S,e));const n=t.indexOf("]",e+1);if(-1===n){N+=t.slice(e);break}N+=t.slice(e+1,n),S=n+1}return N}(e,t.pattern,n)}if(!("mode"in t)||void 0===t.mode)throw new TypeError("format() expects `mode` or `pattern`");const n=t.mode;switch(n){case"standard":return function(e,t){const n=Y(e),r=t?.locale??"en-BD",m=t?.month??"short",g=t?.year??"numeric",h=t?.day??"numeric",f=t?.weekday,y=t?.hour,$=t?.minute,w=t?.second,p=void 0!==y||void 0!==$||void 0!==w,v="bn-BD"===r;A(m,["short","long"],"month format for standard mode"),A(g,["numeric","2-digit"],"year format for standard mode"),A(h,["numeric","2-digit"],"day format for standard mode"),void 0!==f&&A(f,["short","long"],"weekday format for standard mode"),void 0!==y&&A(y,["numeric","2-digit"],"hour format for standard mode"),void 0!==$&&A($,["numeric","2-digit"],"minute format for standard mode"),void 0!==w&&A(w,["numeric","2-digit"],"second format for standard mode");const D=n.getDate(),M=n.getMonth(),T=n.getFullYear(),N=v?" খ্রিস্টাব্দ":"",S=`${"2-digit"===h?String(D).padStart(2,"0"):v?B(D):H(D)} ${(v?"short"===m?d:s:"short"===m?a:o)[M]} ${"2-digit"===g?String(T).slice(-2):String(T)}${N}`,F=void 0!==f?`${(v?"short"===f?c:l:"short"===f?u:i)[n.getDay()]}, `:"";let j="";if(p){const e=t?.hour12??!1,o=n.getHours(),a=$??(void 0!==w?"2-digit":void 0);j=`${I(e?o%12||12:o,y??"numeric")}${void 0!==a?`:${I(n.getMinutes(),a)}`:""}${void 0!==w?`:${I(n.getSeconds(),w)}`:""}${e?` ${E(o,r,!1)}`:""}`}const k=`${F}${S}${j?`, ${j}`:""}`;return v?b(k):k}(e,t);case"bangla":return function(e,t){const n=t?.locale??"en-BD",r=t?.format??"ordinal",o=t?.variant,a=F(e);if("bn-BD"===n){const e=a.monthIndex-1,t={format:r};return void 0!==o&&(t.variant=o),`${U(a.day,t)} ${m[e]} ${b(a.year)} বঙ্গাব্দ`}return`${H(a.day)} ${a.month} ${a.year}`}(e,t);case"hijri":return function(e,t){const n=t?.locale??"en-BD",r=t?.timeZone;if("bn-BD"===n){const t={locale:n};void 0!==r&&(t.timeZone=r);const o=C(e,t),a=b(o.year);return`${function(e){const t=b(e);return 1===e?`${t}লা`:2===e?`${t}রা`:`${t}ই`}(Number($(o.day)))} ${o.month} ${a} হিজরি`}const o={locale:n};void 0!==r&&(o.timeZone=r);const a=C(e,o);return`${H(a.day)} ${a.month} ${a.year} AH`}(e,t);case"hybrid":return function(e,t){const n=Y(e),r=t?.digits??"en",i=t?.month??"bn",u=t?.year??"en",l=t?.day??r,c=t?.monthFormat??"long";A(r,["en","bn"],"digits language for hybrid mode"),A(i,["en","bn"],"month language for hybrid mode"),A(u,["en","bn"],"year language for hybrid mode"),A(l,["en","bn"],"day language for hybrid mode"),A(c,["short","long"],"month format for hybrid mode");const m=n.getDate(),g=n.getMonth(),h=n.getFullYear(),f="bn"===i?"short"===c?d:s:"short"===c?a:o,y="bn"===l?b(m):String(m),$=f[g],w="bn"===u?b(h):String(h);return`${y} ${$} ${w}`}(e,t);default:throw new TypeError(`Invalid format mode: ${String(n)}`)}}var L=1e3,J=36e5,O=24*J,W=[{threshold:7*O,singular:"week",plural:"weeks"},{threshold:O,singular:"day",plural:"days"},{threshold:J,singular:"hour",plural:"hours"},{threshold:6e4,singular:"minute",plural:"minutes"},{threshold:L,singular:"second",plural:"seconds"}];function R(e,t){return new Date(e,t+1,0).getDate()}function P(e,t){let n=e.getFullYear()-t.getFullYear();const r=function(e,t){const n=e.getFullYear()+t,r=e.getMonth(),o=Math.min(e.getDate(),R(n,r));return new Date(n,r,o,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function q(e,t){let n=12*(e.getFullYear()-t.getFullYear())+(e.getMonth()-t.getMonth());const r=function(e,t){const n=e.getFullYear(),r=e.getMonth()+t,o=n+Math.floor(r/12),a=(r%12+12)%12,i=Math.min(e.getDate(),R(o,a));return new Date(o,a,i,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function z(e,t,n,r,o){const a="bn-BD"===o,i=a?b(e):String(e),u=1===e?t:n;return a?r?`${i} ${u} আগে`:`${i} ${u} পরে`:r?`${i} ${u} ago`:`in ${i} ${u}`}function K(e,t,n){return"bn-BD"===n?"day"===e?t?"গতকাল":"আগামীকাল":"week"===e?t?"গত সপ্তাহে":"আগামী সপ্তাহে":"month"===e?t?"গত মাসে":"আগামী মাসে":t?"গত বছর":"আগামী বছর":"day"===e?t?"yesterday":"tomorrow":"week"===e?t?"last week":"next week":"month"===e?t?"last month":"next month":t?"last year":"next year"}function G(e){return"string"==typeof e&&!/(?:T|\s)\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/i.test(e.trim())&&null!==function(e){if(e instanceof Date)return Number.isNaN(e.getTime())?null:new Date(e.getTime());if("number"==typeof e){const t=new Date(e);return Number.isNaN(t.getTime())?null:t}return N($(e).trim())}(e)}function Q(e,t){return G(e)?function(e){return`${String(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}(t):t.toISOString()}var V=e(function({value:e,locale:n,month:r,year:o,day:a,weekday:i,hour:u,minute:s,second:d,hour12:l,srLabel:c,"aria-label":m,...g},h){const f=Y(e),y=Z(f,{mode:"standard",...{...void 0!==n&&{locale:n},...void 0!==r&&{month:r},...void 0!==o&&{year:o},...void 0!==a&&{day:a},...void 0!==i&&{weekday:i},...void 0!==u&&{hour:u},...void 0!==s&&{minute:s},...void 0!==d&&{second:d},...void 0!==l&&{hour12:l}}}),b=Q(e,f);return t("time",{...g,ref:h,dateTime:b,"aria-label":c??m??y},y)});V.displayName="Tarikh";var X=e(function({value:e,locale:n,numeric:r,srLabel:o,"aria-label":a,...i},u){const s=Y(e),d={...void 0!==n&&{locale:n},...void 0!==r&&{numeric:r}},l=function(e,t){const n=Y(e),r=t?.locale??"en-BD",o=t?.numeric??"always",a="bn-BD"===r?y:f,i=Date.now()-n.getTime(),u=Math.abs(i),s=i>0,d=new Date,l=n.getFullYear()===d.getFullYear()&&n.getMonth()===d.getMonth()&&n.getDate()===d.getDate(),c=s?d:n,m=s?n:d;if(u<L)return a.justNow;if("auto"===o&&l)return function(e){return"bn-BD"===e?"আজ":"today"}(r);const g=P(c,m);if(g>=1){if("auto"===o&&1===g){const e=K("year",s,r);if(null!==e)return e}return z(g,a.year,a.years,s,r)}const h=q(c,m);if(h>=1){if("auto"===o&&1===h){const e=K("month",s,r);if(null!==e)return e}return z(h,a.month,a.months,s,r)}for(const e of W)if(u>=e.threshold){const t=Math.floor(u/e.threshold);if("auto"===o&&1===t&&("day"===e.singular||"week"===e.singular)){const t=K(e.singular,s,r);if(null!==t)return t}return z(t,a[e.singular],a[e.plural],s,r)}return a.justNow}(s,Object.keys(d).length>0?d:void 0),c=Q(e,s);return t("time",{...i,ref:u,dateTime:c,"aria-label":o??a??l},l)});X.displayName="RelativeTime";var _=e(function({value:e,locale:n,format:r,variant:o,srLabel:a,"aria-label":i,...u},s){const d=Y(e),l=Z(d,{mode:"bangla",...{...void 0!==n&&{locale:n},...void 0!==r&&{format:r},...void 0!==o&&{variant:o}}}),c=Q(e,d);return t("time",{...u,ref:s,dateTime:c,"aria-label":a??i??l},l)});_.displayName="BanglaDate";var ee=e(function({value:e,locale:n,timeZone:r,srLabel:o,"aria-label":a,...i},u){const s=Y(e),d=Z(s,{mode:"hijri",...{...void 0!==n&&{locale:n},...void 0!==r&&{timeZone:r}}}),l=Q(e,s);return t("time",{...i,ref:u,dateTime:l,"aria-label":o??a??d},d)});ee.displayName="HijriDate",V.Relative=X,V.Bangla=_,V.Hijri=ee;export{V as Tarikh};
|
|
2
|
+
import{forwardRef as e,createElement as t}from"react";var n=["0","1","2","3","4","5","6","7","8","9"],r=["০","১","২","৩","৪","৫","৬","৭","৮","৯"],o=["January","February","March","April","May","June","July","August","September","October","November","December"],i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s=["জানুয়ারি","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],d=["জানু","ফেব্রু","মার্চ","এপ্রি","মে","জুন","জুলা","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],l=["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"],m=["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],c=["বৈশাখ","জ্যৈষ্ঠ","আষাঢ়","শ্রাবণ","ভাদ্র","আশ্বিন","কার্তিক","অগ্রহায়ণ","পৌষ","মাঘ","ফাল্গুন","চৈত্র"],h=["Baishakh","Jaishtho","Asharh","Shrabon","Bhadro","Ashshin","Kartik","Agrahayan","Poush","Magh","Falgun","Chaitra"],g=[31,31,31,31,31,30,30,30,30,30,30,30],f={second:"second",seconds:"seconds",minute:"minute",minutes:"minutes",hour:"hour",hours:"hours",day:"day",days:"days",week:"week",weeks:"weeks",month:"month",months:"months",year:"year",years:"years",ago:"ago",in:"in",justNow:"just now"},y={second:"সেকেন্ড",seconds:"সেকেন্ড",minute:"মিনিট",minutes:"মিনিট",hour:"ঘণ্টা",hours:"ঘণ্টা",day:"দিন",days:"দিন",week:"সপ্তাহ",weeks:"সপ্তাহ",month:"মাস",months:"মাস",year:"বছর",years:"বছর",ago:"আগে",in:"",justNow:"এইমাত্র"};function b(e){return String(e).replace(/\d/g,e=>r[Number(e)]??e)}function p(e){return String(e).replace(/[০-৯]/g,e=>{const t=r.indexOf(e);return t>=0?n[t]??e:e})}var v={jan:0,"jan.":0,january:0,"january,":0,feb:1,"feb.":1,february:1,"february,":1,mar:2,"mar.":2,march:2,"march,":2,apr:3,"apr.":3,april:3,"april,":3,may:4,"may,":4,jun:5,"jun.":5,june:5,"june,":5,jul:6,"jul.":6,july:6,"july,":6,aug:7,"aug.":7,august:7,"august,":7,sep:8,sept:8,"sep.":8,"sept.":8,september:8,"september,":8,oct:9,"oct.":9,october:9,"october,":9,nov:10,"nov.":10,november:10,"november,":10,dec:11,"dec.":11,december:11,"december,":11,"জানুয়ারি":0,"জানুয়ারি":0,"ফেব্রুয়ারি":1,"ফেব্রুয়ারি":1,"মার্চ":2,"এপ্রিল":3,"মে":4,"জুন":5,"জুলাই":6,"আগস্ট":7,"অগাস্ট":7,"সেপ্টেম্বর":8,"সেপ্টেম্বার":8,"অক্টোবর":9,"নভেম্বর":10,"নভেম্বার":10,"ডিসেম্বর":11,"ডিসেম্বার":11};function w(e){const t=e.trim(),n=t.toLowerCase(),r=v[n];if(void 0!==r)return r;for(let e=0;e<o.length;e++)if(o[e].toLowerCase()===n)return e;for(let e=0;e<i.length;e++)if(i[e].toLowerCase()===n)return e;for(let e=0;e<s.length;e++)if(s[e]===t)return e;for(let e=0;e<d.length;e++)if(d[e]===t)return e;return-1}function $(e){return Number.isFinite(e)&&Math.abs(e)<=864e13}function D(e,t,n,r=0,o=0,i=0,a=0){const u=new Date(0);return u.setUTCFullYear(e,t,n),u.setUTCHours(r,o,i,a),u.getUTCFullYear()!==e||u.getUTCMonth()!==t||u.getUTCDate()!==n||u.getUTCHours()!==r||u.getUTCMinutes()!==o||u.getUTCSeconds()!==i||u.getUTCMilliseconds()!==a?null:u}function S(e,t,n,r=0,o=0,i=0,a=0){return function(e,t,n,r=0,o=0,i=0,a=0){const u=new Date(0);return u.setFullYear(e,t,n),u.setHours(r,o,i,a),u.getFullYear()!==e||u.getMonth()!==t||u.getDate()!==n||u.getHours()!==r||u.getMinutes()!==o||u.getSeconds()!==i||u.getMilliseconds()!==a?null:u}(e,t,n,r,o,i,a)??D(e,t,n,r,o,i,a)}function M(e){if(!/^[+-]?\d+$/.test(e))return null;const t=Number(e);return Number.isInteger(t)?t:null}function N(e){return function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})([-/.])(\d{1,2})\2(\d{1,2})$/);return t?S(Number(t[1]),Number(t[3])-1,Number(t[4])):null}(e)??function(e){const t=e.trim().match(/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:?\d{2})?)$/);if(!t)return null;const n=Number(t[1]),r=Number(t[2]),o=Number(t[3]),i=Number(t[4]??0),a=Number(t[5]??0),u=Number(t[6]??0),s=Number((t[7]??"0").padEnd(3,"0").slice(0,3)),d=t[8];if(void 0===d)return S(n,r-1,o,i,a,u,s);const l=d.match(/^([+-])(\d{2}):?(\d{2})$/),m=l?Number(l[2]):null,c=l?Number(l[3]):null,h="Z"===d?0:l&&null!==m&&null!==c&&m<=23&&c<=59?("+"===l[1]?1:-1)*(60*m+c):null;if(null===h)return null;const g=D(n,r-1,o,i,a,u,s);if(!g)return null;const f=g.getTime()-6e4*h;if(!$(f))return null;const y=new Date(f),b=new Date(f+6e4*h);return b.getUTCFullYear()!==n||b.getUTCMonth()!==r-1||b.getUTCDate()!==o||b.getUTCHours()!==i||b.getUTCMinutes()!==a||b.getUTCSeconds()!==u||b.getUTCMilliseconds()!==s?null:y}(e)??function(e){const t=e.match(/^(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:\s+|-)(\S+)(?:\s+|-)([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=Number(t[1]),r=t[2].replace(/,$/,""),o=t[3],i=w(r);if(-1===i)return null;const a=M(o);if(null===a)return null;let u=a;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),S(u,i,n)}(e)??function(e){const t=e.match(/^(\S+)\s+(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:,)?\s+([+-]\d{6}|\d{4}|\d{2})$/);if(!t)return null;const n=t[1].replace(/,$/,""),r=Number(t[2]),o=t[3],i=w(n);if(-1===i)return null;const a=M(o);if(null===a)return null;let u=a;return o.startsWith("+")||o.startsWith("-")||2!==o.length||(u+=u>=50?1900:2e3),S(u,i,r)}(e)}function T(e,t,n){if(!$(e.getTime())){throw new RangeError(`${"Date input"} is outside the supported range: ${String(t)}`)}return e}function j(e){if(e instanceof Date){const t=e.getTime();if(Number.isNaN(t))throw new Error(`Invalid date input: ${String(e)}`);return T(new Date(t),e)}if("number"==typeof e){if(!Number.isFinite(e))throw new Error(`Invalid date input: ${String(e)}`);const t=new Date(e);if(Number.isNaN(t.getTime())){if(!$(e))throw new RangeError(`Date input is outside the supported range: ${String(e)}`);throw new Error(`Invalid date input: ${String(e)}`)}return T(t,e)}const t=N(p(e).trim());if(!t)throw new Error(`Invalid date input: ${String(e)}`);return T(t,e)}function k(e,t){const n=j(e),r=n.getFullYear(),o=n.getMonth(),i=n.getDate(),a=new Date(r,3,14),u=o<3||3===o&&i<14,s=u?r-594:r-593,d=function(e,t){const n=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.floor((r-n)/864e5)}(u?new Date(r-1,3,14):a,n)+1,l=function(e){const t=[...g];return function(e){return(t=e+594)%4==0&&t%100!=0||t%400==0;var t}(e)&&(t[10]=31),t}(s);let m=d,c=0;for(let e=0;e<l.length;e++){const t=l[e];if(m<=t){c=e;break}m-=t}return{day:m,month:h[c],monthIndex:c+1,year:s}}var F=["Asia/Dhaka","UTC"],Y={locale:"en-BD",mode:"standard",month:void 0,timeZone:"Asia/Dhaka",hijriSystem:"islamic-umalqura"};function B(){return{...Y}}function C(e,t){const n=e.find(e=>e.type===t);if(void 0===n)throw new Error(`Missing ${t} part while formatting Hijri date.`);return n.value}function I(e,t){const n=B(),r=t?.locale??"en-BD",o=t?.timeZone??n.timeZone,i=t?.hijriSystem??n.hijriSystem;!function(e){if(!F.includes(e))throw new RangeError(`Unsupported Hijri time zone: ${e}. Supported values: ${F.join(", ")}`)}(o),function(e){if(!["islamic-umalqura","islamic-civil"].includes(e))throw new RangeError(`Unsupported Hijri calendar system: ${e}. Supported values: islamic-umalqura, islamic-civil`)}(i);const a=function(e,t,n,r){const o=function(e,t){return`${e}-u-ca-${t}`}(t,r),i=new Intl.DateTimeFormat(o,{day:"numeric",month:"numeric",year:"numeric",timeZone:n}).formatToParts(e),a=new Intl.DateTimeFormat(o,{day:"numeric",month:"long",year:"numeric",timeZone:n}).formatToParts(e);return{day:C(i,"day"),month:C(a,"month"),monthIndex:Number(p(C(i,"month"))),year:C(i,"year")}}(j(e),r,o,i);return"bn-BD"===r?{day:b(a.day),month:a.month,monthIndex:a.monthIndex,year:b(a.year)}:{day:Number(p(a.day)),month:a.month,monthIndex:a.monthIndex,year:Number(p(a.year))}}function H(e){const t=b(e);return 1===e?`${t}লা`:2===e||3===e?`${t}রা`:4===e?`${t}ঠা`:e>=19?`${t}শে`:`${t}ই`}function U(e){const t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function Z(e,t){return"spoken"===(t?.format??"ordinal")?function(e,t="pohela"){switch(e){case 1:return"poyla"===t?"পয়লা":"পহেলা";case 2:return"দোসরা";case 3:return"তেসরা";case 4:return"চৌঠা";default:return H(e)}}(e,t?.variant):H(e)}function E(e,t){return"2-digit"===t?String(e).padStart(2,"0"):String(e)}function x(e,t,n){const r=E(e,n);return"bn-BD"===t?b(r):r}function A(e,t,n){if(!t.includes(e))throw new TypeError(`Invalid ${n}: ${e}`)}function _(e,t,n){if("bn-BD"===t)return e<12?"পূর্বাহ্ণ":"অপরাহ্ণ";const r=e<12?"AM":"PM";return n?r.toLowerCase():r}function L(e,t){const n=j(e),r=`${o=n.getFullYear(),o>=0&&o<=9999?String(o).padStart(4,"0"):`${o>=0?"+":"-"}${String(Math.abs(o)).padStart(6,"0")}`}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")} ${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}:${String(n.getSeconds()).padStart(2,"0")}`;var o;return"bn-BD"===t?b(r):r}function R(e,t){if(void 0!==t&&(null===t||"object"!=typeof t||Array.isArray(t)))throw new TypeError("format() expects an options object");const n=B();if(t&&"pattern"in t&&void 0!==t.pattern){if("mode"in t&&void 0!==t.mode)throw new TypeError("Do not pass `mode` when `pattern` is provided. `pattern` formatting does not use mode.");const r=t.locale??n.locale;return function(e,t,n="en-BD"){const r=j(e),c="bn-BD"===n,h=r.getDate(),g=r.getMonth(),f=r.getFullYear(),y=c?s:o,b=c?d:i,p=c?l:a,v=c?m:u,w=r.getHours(),$=w%12||12,D={dddd:p[r.getDay()],ddd:v[r.getDay()],MMMM:y[g],MMM:b[g],MM:x(g+1,n,"2-digit"),M:x(g+1,n,"numeric"),DD:x(h,n,"2-digit"),D:x(h,n,"numeric"),HH:x(w,n,"2-digit"),H:x(w,n,"numeric"),hh:x($,n,"2-digit"),h:x($,n,"numeric"),mm:x(r.getMinutes(),n,"2-digit"),m:x(r.getMinutes(),n,"numeric"),ss:x(r.getSeconds(),n,"2-digit"),s:x(r.getSeconds(),n,"numeric"),A:_(w,n,!1),a:_(w,n,!0),YYYY:x(f,n,"numeric"),YY:x(Number(String(f).slice(-2)),n,"2-digit")},S=/dddd|ddd|MMMM|MMM|MM|M|DD|D|YYYY|YY|HH|H|hh|h|mm|m|ss|s|A|a/g,M=e=>e.replace(S,e=>D[e]);let N="",T=0;for(;T<t.length;){const e=t.indexOf("[",T);if(-1===e){N+=M(t.slice(T));break}N+=M(t.slice(T,e));const n=t.indexOf("]",e+1);if(-1===n){N+=t.slice(e);break}N+=t.slice(e+1,n),T=n+1}return N}(e,t.pattern,r)}const r=function(e,t){if(void 0===e)return t;if("mode"in e&&void 0!==e.mode)return e.mode;const n=e;return"digits"in n||"monthFormat"in n||"en"===n.month||"bn"===n.month||"en"===n.year||"bn"===n.year||"en"===n.day||"bn"===n.day?"hybrid":"timeZone"in n||"hijriSystem"in n?"hijri":"format"in n||"variant"in n?"bangla":"weekday"in n||"hour"in n||"minute"in n||"second"in n||"hour12"in n||"preset"in n||"short"===n.month||"long"===n.month||"numeric"===n.year||"2-digit"===n.year||"numeric"===n.day||"2-digit"===n.day?"standard":t}(t,n.mode);switch(r){case"standard":return function(e,t){const n=B(),r=t?.locale??n.locale;if("isoLike"===t?.preset)return L(e,r);const c=function(e){return"dateTime"===e?.preset?{hour:"2-digit",minute:"2-digit",...e}:e??{}}(t),h=j(e),g=c.month??n.month??("bn-BD"===r?"long":"short"),f=c.year??"numeric",y=c.day??"numeric",p=c.weekday,v=c.hour,w=c.minute,$=c.second,D=void 0!==v||void 0!==w||void 0!==$,S="bn-BD"===r;A(g,["short","long"],"month format for standard mode"),A(f,["numeric","2-digit"],"year format for standard mode"),A(y,["numeric","2-digit"],"day format for standard mode"),void 0!==p&&A(p,["short","long"],"weekday format for standard mode"),void 0!==v&&A(v,["numeric","2-digit"],"hour format for standard mode"),void 0!==w&&A(w,["numeric","2-digit"],"minute format for standard mode"),void 0!==$&&A($,["numeric","2-digit"],"second format for standard mode");const M=h.getDate(),N=h.getMonth(),T=h.getFullYear(),k=S?" খ্রিস্টাব্দ":"",F=`${"2-digit"===y?String(M).padStart(2,"0"):S?H(M):U(M)} ${(S?"short"===g?d:s:"short"===g?i:o)[N]} ${"2-digit"===f?String(T).slice(-2):String(T)}${k}`,Y=void 0!==p?`${(S?"short"===p?m:l:"short"===p?u:a)[h.getDay()]}, `:"";let C="";if(D){const e=c.hour12??!1,t=h.getHours(),n=w??(void 0!==$?"2-digit":void 0);C=`${E(e?t%12||12:t,v??"numeric")}${void 0!==n?`:${E(h.getMinutes(),n)}`:""}${void 0!==$?`:${E(h.getSeconds(),$)}`:""}${e?` ${_(t,r,!1)}`:""}`}const I=`${Y}${F}${C?`, ${C}`:""}`;return S?b(I):I}(e,t);case"bangla":return function(e,t){const n=t?.locale??B().locale,r=t?.format??"ordinal",o=t?.variant,i=k(e);if("bn-BD"===n){const e=i.monthIndex-1,t={format:r};return void 0!==o&&(t.variant=o),`${Z(i.day,t)} ${c[e]} ${b(i.year)} বঙ্গাব্দ`}return`${U(i.day)} ${i.month} ${i.year}`}(e,t);case"hijri":return function(e,t){const n=t?.locale??B().locale;if("bn-BD"===n){const n=I(e,{locale:"bn-BD",...void 0!==t?.timeZone&&{timeZone:t.timeZone},...void 0!==t?.hijriSystem&&{hijriSystem:t.hijriSystem}}),r=b(n.year);return`${function(e){const t=b(e);return 1===e?`${t}লা`:2===e?`${t}রা`:`${t}ই`}(Number(p(n.day)))} ${n.month} ${r} হিজরি`}const r=I(e,{locale:"en-BD",...void 0!==t?.timeZone&&{timeZone:t.timeZone},...void 0!==t?.hijriSystem&&{hijriSystem:t.hijriSystem}});return`${U(r.day)} ${r.month} ${r.year} AH`}(e,t);case"hybrid":return function(e,t){const n=j(e),r=t?.digits??"en",a=t?.month??"bn",u=t?.year??"en",l=t?.day??r,m=t?.monthFormat??"long";A(r,["en","bn"],"digits language for hybrid mode"),A(a,["en","bn"],"month language for hybrid mode"),A(u,["en","bn"],"year language for hybrid mode"),A(l,["en","bn"],"day language for hybrid mode"),A(m,["short","long"],"month format for hybrid mode");const c=n.getDate(),h=n.getMonth(),g=n.getFullYear(),f="bn"===a?"short"===m?d:s:"short"===m?i:o,y="bn"===l?b(c):String(c),p=f[h],v="bn"===u?b(g):String(g);return`${y} ${p} ${v}`}(e,t);default:throw new TypeError(`Invalid format mode: ${String(r)}`)}}var J=/^([+-]\d{6}|\d{4})([-/.])(\d{1,2})\2(\d{1,2})$/,O=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}:?\d{2})?)$/,W=/^(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:\s+|-)(\S+)(?:\s+|-)([+-]\d{6}|\d{4}|\d{2})$/i,P=/^(\S+)\s+(\d{1,2})(?:st|nd|rd|th|লা|রা|ঠা|ই|শে)?(?:,)?\s+([+-]\d{6}|\d{4}|\d{2})$/i;function q(e,t,n,r,o,i){return{success:!0,input:e,normalizedInput:t,calendar:n,strict:r,format:o,date:i}}function z(e,t,n,r,o,i){return{success:!1,input:e,normalizedInput:t,calendar:n,strict:r,reason:o,message:i,date:null}}function G(e,t,n){const r=function(e){if(J.test(e))return"ymd";if(O.test(e))return"iso_datetime";const t=e.match(W);if(t&&-1!==w(t[2].replace(/,$/,"")))return"day_month_year";const n=e.match(P);return n&&-1!==w(n[1].replace(/,$/,""))?"month_day_year":null}(t);if(null===r)return z(e,t,"gregorian",n,"invalid_string","Input does not match a supported Gregorian date format.");const o=N(t);return null===o?z(e,t,"gregorian",n,"invalid_string","Input matches a Gregorian date shape but is not a valid calendar date."):q(e,t,"gregorian",n,r,o)}function K(e,t){const n=function(e){const t="gregorian",n=!1;if(e instanceof Date)return Number.isNaN(e.getTime())?z(e,null,t,n,"invalid_date_object","Date object is invalid."):q(e,null,t,n,"date_object",new Date(e.getTime()));if("number"==typeof e){if(!Number.isFinite(e))return z(e,e,t,n,"invalid_timestamp","Timestamp is invalid.");const r=new Date(e);if(Number.isNaN(r.getTime())){const r=Math.abs(e)>864e13;return z(e,e,t,n,r?"out_of_range":"invalid_timestamp",r?"Timestamp is outside the supported Date range.":"Timestamp is invalid.")}return q(e,e,t,n,"timestamp",r)}const r=p(e).trim();return 0===r.length?z(e,r,t,n,"invalid_string","Input is empty."):G(e,r,n)}(e);return n.success?n.date:null}var Q=1e3,V=36e5,X=24*V,ee={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",week:"wk",weeks:"wk",month:"mo",months:"mo",year:"y",years:"y",ago:"ago",in:"in",justNow:"now"},te={second:"সে.",seconds:"সে.",minute:"মি.",minutes:"মি.",hour:"ঘ.",hours:"ঘ.",day:"দিন",days:"দিন",week:"সপ্তা.",weeks:"সপ্তা.",month:"মাস",months:"মাস",year:"বছ.",years:"বছ.",ago:"আগে",in:"",justNow:"এখন"},ne={justNow:Q,minute:6e4,hour:V,day:X,week:7*X,month:30*X,year:365*X};function re(e,t){return new Date(e,t+1,0).getDate()}function oe(e,t){let n=e.getFullYear()-t.getFullYear();const r=function(e,t){const n=e.getFullYear()+t,r=e.getMonth(),o=Math.min(e.getDate(),re(n,r));return new Date(n,r,o,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function ie(e,t){let n=12*(e.getFullYear()-t.getFullYear())+(e.getMonth()-t.getMonth());const r=function(e,t){const n=e.getFullYear(),r=e.getMonth()+t,o=n+Math.floor(r/12),i=(r%12+12)%12,a=Math.min(e.getDate(),re(o,i));return new Date(o,i,a,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t,n);return r>e&&(n-=1),n}function ae(e,t){if(!Number.isFinite(e)||e<0)throw new RangeError(`Invalid relative time threshold for ${t}: ${e}`)}function ue(e,t,n,r,o,i){const a="bn-BD"===o,u=a?b(e):String(e),s=1===e?t:n,d="short"===i&&"en-BD"===o?`${u}${s}`:`${u} ${s}`;return a?r?`${d} আগে`:`${d} পরে`:r?`${d} ago`:`in ${d}`}function se(e,t,n){return"bn-BD"===n?"day"===e?t?"গতকাল":"আগামীকাল":"week"===e?t?"গত সপ্তাহে":"আগামী সপ্তাহে":"month"===e?t?"গত মাসে":"আগামী মাসে":t?"গত বছর":"আগামী বছর":"day"===e?t?"yesterday":"tomorrow":"week"===e?t?"last week":"next week":"month"===e?t?"last month":"next month":t?"last year":"next year"}function de(e,t){const n=B(),r=j(e),o=t?.locale??n.locale,i=t?.numeric??"always",a=t?.style??"long",u=function(e){const t={...ne,...e};ae(t.justNow,"justNow"),ae(t.minute,"minute"),ae(t.hour,"hour"),ae(t.day,"day"),ae(t.week,"week"),ae(t.month,"month"),ae(t.year,"year");const n=[t.justNow,t.minute,t.hour,t.day,t.week,t.month,t.year];for(let e=1;e<n.length;e+=1)if(n[e]<n[e-1])throw new RangeError("Relative time thresholds must be non-decreasing from justNow to year");return t}(t?.threshold),s=void 0===t?.baseDate?new Date:j(t.baseDate),d=function(e,t){return"short"===t?"bn-BD"===e?te:ee:"bn-BD"===e?y:f}(o,a),l=s.getTime()-r.getTime(),m=Math.abs(l),c=l>0,h=c?s:r,g=c?r:s;if(m<u.justNow)return d.justNow;if("auto"===i&&(p=s,(b=r).getFullYear()===p.getFullYear()&&b.getMonth()===p.getMonth()&&b.getDate()===p.getDate()))return function(e){return"bn-BD"===e?"আজ":"today"}(o);var b,p;const v=oe(h,g);if(v>=1&&m>=u.year){if("auto"===i&&1===v){const e=se("year",c,o);if(null!==e)return e}return ue(v,d.year,d.years,c,o,a)}const w=ie(h,g);if(w>=1&&m>=u.month){if("auto"===i&&1===w){const e=se("month",c,o);if(null!==e)return e}return ue(w,d.month,d.months,c,o,a)}const $=[{threshold:u.week,singular:"week",plural:"weeks"},{threshold:u.day,singular:"day",plural:"days"},{threshold:u.hour,singular:"hour",plural:"hours"},{threshold:u.minute,singular:"minute",plural:"minutes"},{threshold:Q,singular:"second",plural:"seconds"}];for(const e of $)if(m>=e.threshold){const t=Math.floor(m/e.threshold);if("auto"===i&&1===t&&("day"===e.singular||"week"===e.singular)){const t=se(e.singular,c,o);if(null!==t)return t}return ue(t,d[e.singular],d[e.plural],c,o,a)}return d.justNow}function le(e,t){return function(e){return"string"==typeof e&&!/(?:T|\s)\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/i.test(e.trim())&&null!==K(e)}(e)?function(e){return`${String(e.getFullYear())}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}(t):t.toISOString()}var me=e(function({value:e,locale:n,preset:r,month:o,year:i,day:a,weekday:u,hour:s,minute:d,second:l,hour12:m,srLabel:c,"aria-label":h,...g},f){const y=j(e),b=R(y,{mode:"standard",...{...void 0!==n&&{locale:n},...void 0!==r&&{preset:r},...void 0!==o&&{month:o},...void 0!==i&&{year:i},...void 0!==a&&{day:a},...void 0!==u&&{weekday:u},...void 0!==s&&{hour:s},...void 0!==d&&{minute:d},...void 0!==l&&{second:l},...void 0!==m&&{hour12:m}}}),p=le(e,y);return t("time",{...g,ref:f,dateTime:p,"aria-label":c??h??b},b)});me.displayName="Tarikh";var ce=e(function({value:e,locale:n,numeric:r,baseDate:o,relativeStyle:i,threshold:a,srLabel:u,"aria-label":s,...d},l){const m=j(e),c={...void 0!==n&&{locale:n},...void 0!==r&&{numeric:r},...void 0!==o&&{baseDate:o},...void 0!==i&&{style:i},...void 0!==a&&{threshold:a}},h=de(m,Object.keys(c).length>0?c:void 0),g=le(e,m);return t("time",{...d,ref:l,dateTime:g,"aria-label":u??s??h},h)});ce.displayName="RelativeTime";var he=e(function({value:e,locale:n,format:r,variant:o,srLabel:i,"aria-label":a,...u},s){const d=j(e),l=R(d,{mode:"bangla",...{...void 0!==n&&{locale:n},...void 0!==r&&{format:r},...void 0!==o&&{variant:o}}}),m=le(e,d);return t("time",{...u,ref:s,dateTime:m,"aria-label":i??a??l},l)});he.displayName="BanglaDate";var ge=e(function({value:e,locale:n,timeZone:r,hijriSystem:o,srLabel:i,"aria-label":a,...u},s){const d=j(e),l=R(d,{mode:"hijri",...{...void 0!==n&&{locale:n},...void 0!==r&&{timeZone:r},...void 0!==o&&{hijriSystem:o}}}),m=le(e,d);return t("time",{...u,ref:s,dateTime:m,"aria-label":i??a??l},l)});ge.displayName="HijriDate",me.Relative=ce,me.Bangla=he,me.Hijri=ge;export{me as Tarikh};
|
package/package.json
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@coreify/tarikh",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "A modern Bangladesh-first date toolkit for formatting, Bangla calendar, Hijri calendar, and localization in JavaScript, TypeScript, and React apps.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"sideEffects": false,
|
|
7
|
-
"main": "./dist/index.cjs",
|
|
8
|
-
"module": "./dist/index.js",
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"require": "./dist/index.cjs"
|
|
15
|
-
},
|
|
16
|
-
"./react": {
|
|
17
|
-
"types": "./dist/react.d.ts",
|
|
18
|
-
"import": "./dist/react.js",
|
|
19
|
-
"require": "./dist/react.cjs"
|
|
20
|
-
},
|
|
21
|
-
"./package.json": "./package.json"
|
|
22
|
-
},
|
|
23
|
-
"files": [
|
|
24
|
-
"dist",
|
|
25
|
-
"README.md",
|
|
26
|
-
"LICENSE"
|
|
27
|
-
],
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=18"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsup",
|
|
33
|
-
"build:watch": "tsup --watch",
|
|
34
|
-
"typecheck": "tsc --noEmit",
|
|
35
|
-
"lint": "eslint .",
|
|
36
|
-
"ci": "npm run lint && npm run typecheck && npm test",
|
|
37
|
-
"test": "npm run build && vitest run",
|
|
38
|
-
"test:unit": "vitest run",
|
|
39
|
-
"test:watch": "vitest",
|
|
40
|
-
"format": "prettier --write \"**/*.{ts,tsx,js,json,md}\""
|
|
41
|
-
},
|
|
42
|
-
"license": "MIT",
|
|
43
|
-
"author": "Coreify",
|
|
44
|
-
"repository": {
|
|
45
|
-
"type": "git",
|
|
46
|
-
"url": "git+https://github.com/coreify/tarikh.git"
|
|
47
|
-
},
|
|
48
|
-
"homepage": "https://tarikh.js.org",
|
|
49
|
-
"bugs": {
|
|
50
|
-
"url": "https://github.com/coreify/tarikh/issues"
|
|
51
|
-
},
|
|
52
|
-
"prepack": "npm run build",
|
|
53
|
-
"publishConfig": {
|
|
54
|
-
"access": "public"
|
|
55
|
-
},
|
|
56
|
-
"peerDependencies": {
|
|
57
|
-
"react": ">=18"
|
|
58
|
-
},
|
|
59
|
-
"peerDependenciesMeta": {
|
|
60
|
-
"react": {
|
|
61
|
-
"optional": true
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@eslint/js": "^10.0.1",
|
|
66
|
-
"@types/node": "^25.5.0",
|
|
67
|
-
"@types/react": "^19.2.14",
|
|
68
|
-
"@types/react-dom": "^19.2.3",
|
|
69
|
-
"eslint": "^10.1.0",
|
|
70
|
-
"globals": "^17.4.0",
|
|
71
|
-
"prettier": "^3.8.1",
|
|
72
|
-
"react": "^19.2.4",
|
|
73
|
-
"react-dom": "^19.2.4",
|
|
74
|
-
"terser": "^5.46.1",
|
|
75
|
-
"tsup": "^8.5.1",
|
|
76
|
-
"typescript": "^5.9.3",
|
|
77
|
-
"typescript-eslint": "^8.58.0",
|
|
78
|
-
"vitest": "^4.1.2"
|
|
79
|
-
},
|
|
80
|
-
"keywords": [
|
|
81
|
-
"tarikh",
|
|
82
|
-
"date",
|
|
83
|
-
"bangla",
|
|
84
|
-
"bengali",
|
|
85
|
-
"bangladesh",
|
|
86
|
-
"hijri",
|
|
87
|
-
"islamic",
|
|
88
|
-
"calendar",
|
|
89
|
-
"formatting",
|
|
90
|
-
"localization",
|
|
91
|
-
"react",
|
|
92
|
-
"typescript"
|
|
93
|
-
]
|
|
94
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@coreify/tarikh",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "A modern Bangladesh-first date toolkit for formatting, Bangla calendar, Hijri calendar, and localization in JavaScript, TypeScript, and React apps.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./react": {
|
|
17
|
+
"types": "./dist/react.d.ts",
|
|
18
|
+
"import": "./dist/react.js",
|
|
19
|
+
"require": "./dist/react.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"build:watch": "tsup --watch",
|
|
34
|
+
"typecheck": "tsc --noEmit",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"ci": "npm run lint && npm run typecheck && npm test",
|
|
37
|
+
"test": "npm run build && vitest run",
|
|
38
|
+
"test:unit": "vitest run",
|
|
39
|
+
"test:watch": "vitest",
|
|
40
|
+
"format": "prettier --write \"**/*.{ts,tsx,js,json,md}\""
|
|
41
|
+
},
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"author": "Coreify",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/coreify/tarikh.git"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://tarikh.js.org",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/coreify/tarikh/issues"
|
|
51
|
+
},
|
|
52
|
+
"prepack": "npm run build",
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"react": ">=18"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"react": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@eslint/js": "^10.0.1",
|
|
66
|
+
"@types/node": "^25.5.0",
|
|
67
|
+
"@types/react": "^19.2.14",
|
|
68
|
+
"@types/react-dom": "^19.2.3",
|
|
69
|
+
"eslint": "^10.1.0",
|
|
70
|
+
"globals": "^17.4.0",
|
|
71
|
+
"prettier": "^3.8.1",
|
|
72
|
+
"react": "^19.2.4",
|
|
73
|
+
"react-dom": "^19.2.4",
|
|
74
|
+
"terser": "^5.46.1",
|
|
75
|
+
"tsup": "^8.5.1",
|
|
76
|
+
"typescript": "^5.9.3",
|
|
77
|
+
"typescript-eslint": "^8.58.0",
|
|
78
|
+
"vitest": "^4.1.2"
|
|
79
|
+
},
|
|
80
|
+
"keywords": [
|
|
81
|
+
"tarikh",
|
|
82
|
+
"date",
|
|
83
|
+
"bangla",
|
|
84
|
+
"bengali",
|
|
85
|
+
"bangladesh",
|
|
86
|
+
"hijri",
|
|
87
|
+
"islamic",
|
|
88
|
+
"calendar",
|
|
89
|
+
"formatting",
|
|
90
|
+
"localization",
|
|
91
|
+
"react",
|
|
92
|
+
"typescript"
|
|
93
|
+
]
|
|
94
|
+
}
|