@formatjs/intl-datetimeformat 1.3.2 → 1.3.3
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/CHANGELOG.md +11 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +13 -27
- package/dist/core.js.map +1 -1
- package/dist/polyfill-with-locales-for-test262.min.js +19 -34
- package/dist/polyfill-with-locales-for-test262.min.js.map +1 -1
- package/dist/umd/intl-datetimeformat.js +13 -27
- package/dist/umd/intl-datetimeformat.js.map +1 -1
- package/dist/umd/intl-datetimeformat.min.js +1 -1
- package/dist/umd/intl-datetimeformat.min.js.map +1 -1
- package/dist/umd/polyfill.js +13 -27
- package/dist/umd/polyfill.js.map +1 -1
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +13 -27
- package/lib/core.js.map +1 -1
- package/package.json +7 -6
- package/src/core.ts +14 -27
- package/dist/umd/polyfill-with-locales.js +0 -1645
- package/dist/umd/polyfill-with-locales.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((e=e||self).IntlDateTimeFormat={})}(this,function(e){"use strict";function L(e,a,r){if(void 0===r&&(r=Error),!e)throw new r(a)}function m(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}function E(e,a,r,t,n){var i=e[a];if(void 0===i)return n;if("boolean"!==r&&"string"!==r)throw new TypeError("invalid type");if("boolean"===r&&(i=Boolean(i)),"string"===r&&(i=function(e){if("symbol"==typeof e)throw TypeError("Cannot convert a Symbol value to a string");return String(e)}(i)),void 0!==t&&!t.filter(function(e){return e==i}).length)throw new RangeError(i+" is not within "+t.join(", "));return i}function U(e,a){return Object.is?Object.is(e,a):e===a?0!==e||1/e==1/a:e!=e&&a!=a}["angle-degree","area-acre","area-hectare","concentr-percent","digital-bit","digital-byte","digital-gigabit","digital-gigabyte","digital-kilobit","digital-kilobyte","digital-megabit","digital-megabyte","digital-petabyte","digital-terabit","digital-terabyte","duration-day","duration-hour","duration-millisecond","duration-minute","duration-month","duration-second","duration-week","duration-year","length-centimeter","length-foot","length-inch","length-kilometer","length-meter","length-mile-scandinavian","length-mile","length-millimeter","length-yard","mass-gram","mass-kilogram","mass-ounce","mass-pound","mass-stone","temperature-celsius","temperature-fahrenheit","volume-fluid-ounce","volume-gallon","volume-liter","volume-milliliter"].map(function(e){return e.replace(/^(.*?)-/,"")});function a(e,a,r){var t=r.value;Object.defineProperty(e,a,{configurable:!0,enumerable:!1,writable:!0,value:t})}var t,r=(t=function(e,a){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var r in a)a.hasOwnProperty(r)&&(e[r]=a[r])})(e,a)},function(e,a){function r(){this.constructor=e}t(e,a),e.prototype=null===a?Object.create(a):(r.prototype=a.prototype,new r)}),i=function(){return(i=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)};function T(e){var u,l,y=function(e,a){for(var r={locale:""},t=0,n=a;t<n.length;t++){var i=n[t],o=i.replace(s,""),c=f(e,o);if(c)return r.locale=c,i!==o&&(r.extension=i.slice(o.length+1,i.length)),r}return r.locale=u(),r},b=(l=u=e,function(e,a){for(var r={locale:""},t=0,n=a;t<n.length;t++){var i=n[t],o=i.replace(s,""),c=f(e,o);if(c)return r.locale=c,i!==o&&(r.extension=i.slice(o.length+1,i.length)),r}return r.locale=l(),r});return function(e,a,r,t,n){for(var i,o=("lookup"===r.localeMatcher?y:b)(e,a),c=o.locale,u={locale:"",dataLocale:c},l="-u",s=0,f=t;s<f.length;s++){var m=f[s],d=n[c];L("object"==typeof d&&null!==d,"locale data "+m+" must be an object");var h=d[m];L(Array.isArray(h),"keyLocaleData for "+m+" must be an array");var g=h[0];L("string"==typeof g||null===g,"value must be string or null but got "+typeof g+" in key "+m);var v,p,A="";!o.extension||void 0!==(v=w(o.extension,m))&&(""!==v?~h.indexOf(v)&&(A="-"+m+"-"+(g=v)):~v.indexOf("true")&&(g="true",A="-"+m)),m in r&&(L("string"==typeof(p=r[m])||null==p,"optionsValue must be String, Undefined or Null"),~h.indexOf(p)&&p!==g&&(g=p,A="")),u[m]=g,l+=A}return 2<l.length&&(-1===(i=c.indexOf("-x-"))?c+=l:c=c.slice(0,i)+l+c.slice(i,c.length),c=Intl.getCanonicalLocales(c)[0]),u.locale=c,u}}function w(e,a){L(2===a.length,"key must have 2 elements");var r=e.length,t="-"+a+"-",n=e.indexOf(t);if(-1!==n){for(var i=n+4,o=i,c=i,u=!1;!u;){var l=e.indexOf("-",c);2===(-1===l?r-c:l-c)?u=!0:-1===l?(o=r,u=!0):c=(o=l)+1}return e.slice(i,o)}if(t="-"+a,-1!==(n=e.indexOf(t))&&n+3===r)return""}var s=/-u(?:-[0-9a-z]{2,8})+/gi;function f(e,a){for(var r=a;;){if(~e.indexOf(r))return r;var t=r.lastIndexOf("-");if(!~t)return;2<=t&&"-"===r[t-2]&&(t-=2),r=r.slice(0,t)}}function o(e,a){for(var r=[],t=0,n=a;t<n.length;t++){var i=f(e,n[t].replace(s,""));i&&r.push(i)}return r}var n,c=(n=Error,r(u,n),u);function u(){var e=null!==n&&n.apply(this,arguments)||this;return e.type="MISSING_LOCALE_DATA",e}function d(e,a,r){void 0===r&&(r=function(e,a){return i(i({},e),a)});var t=function(e){for(var a=[e],r=e.split("-"),t=r.length;1<t;t--)a.push(r.slice(0,t-1).join("-"));return a}(e),n=t.map(function(e){return a.data[e]}).filter(Boolean);if(!n.length)throw new c('Missing locale data for "'+e+'", lookup hierarchy: '+t.join(", "));return n.reverse(),n.reduce(r,{})}var l=new WeakMap;function F(e){var a=l.get(e);return a||(a=Object.create(null),l.set(e,a)),a}var h={"Africa/Asmera":"Africa/Nairobi","Africa/Timbuktu":"Africa/Abidjan","America/Argentina/ComodRivadavia":"America/Argentina/Catamarca","America/Atka":"America/Adak","America/Buenos_Aires":"America/Argentina/Buenos_Aires","America/Catamarca":"America/Argentina/Catamarca","America/Coral_Harbour":"America/Atikokan","America/Cordoba":"America/Argentina/Cordoba","America/Ensenada":"America/Tijuana","America/Fort_Wayne":"America/Indiana/Indianapolis","America/Godthab":"America/Nuuk","America/Indianapolis":"America/Indiana/Indianapolis","America/Jujuy":"America/Argentina/Jujuy","America/Knox_IN":"America/Indiana/Knox","America/Louisville":"America/Kentucky/Louisville","America/Mendoza":"America/Argentina/Mendoza","America/Montreal":"America/Toronto","America/Porto_Acre":"America/Rio_Branco","America/Rosario":"America/Argentina/Cordoba","America/Santa_Isabel":"America/Tijuana","America/Shiprock":"America/Denver","America/Virgin":"America/Port_of_Spain","Antarctica/South_Pole":"Pacific/Auckland","Asia/Ashkhabad":"Asia/Ashgabat","Asia/Calcutta":"Asia/Kolkata","Asia/Chongqing":"Asia/Shanghai","Asia/Chungking":"Asia/Shanghai","Asia/Dacca":"Asia/Dhaka","Asia/Harbin":"Asia/Shanghai","Asia/Kashgar":"Asia/Urumqi","Asia/Katmandu":"Asia/Kathmandu","Asia/Macao":"Asia/Macau","Asia/Rangoon":"Asia/Yangon","Asia/Saigon":"Asia/Ho_Chi_Minh","Asia/Tel_Aviv":"Asia/Jerusalem","Asia/Thimbu":"Asia/Thimphu","Asia/Ujung_Pandang":"Asia/Makassar","Asia/Ulan_Bator":"Asia/Ulaanbaatar","Atlantic/Faeroe":"Atlantic/Faroe","Atlantic/Jan_Mayen":"Europe/Oslo","Australia/ACT":"Australia/Sydney","Australia/Canberra":"Australia/Sydney","Australia/LHI":"Australia/Lord_Howe","Australia/NSW":"Australia/Sydney","Australia/North":"Australia/Darwin","Australia/Queensland":"Australia/Brisbane","Australia/South":"Australia/Adelaide","Australia/Tasmania":"Australia/Hobart","Australia/Victoria":"Australia/Melbourne","Australia/West":"Australia/Perth","Australia/Yancowinna":"Australia/Broken_Hill","Brazil/Acre":"America/Rio_Branco","Brazil/DeNoronha":"America/Noronha","Brazil/East":"America/Sao_Paulo","Brazil/West":"America/Manaus","Canada/Atlantic":"America/Halifax","Canada/Central":"America/Winnipeg","Canada/Eastern":"America/Toronto","Canada/Mountain":"America/Edmonton","Canada/Newfoundland":"America/St_Johns","Canada/Pacific":"America/Vancouver","Canada/Saskatchewan":"America/Regina","Canada/Yukon":"America/Whitehorse","Chile/Continental":"America/Santiago","Chile/EasterIsland":"Pacific/Easter",Cuba:"America/Havana",Egypt:"Africa/Cairo",Eire:"Europe/Dublin","Etc/UCT":"Etc/UTC","Europe/Belfast":"Europe/London","Europe/Tiraspol":"Europe/Chisinau",GB:"Europe/London","GB-Eire":"Europe/London","GMT+0":"Etc/GMT","GMT-0":"Etc/GMT",GMT0:"Etc/GMT",Greenwich:"Etc/GMT",Hongkong:"Asia/Hong_Kong",Iceland:"Atlantic/Reykjavik",Iran:"Asia/Tehran",Israel:"Asia/Jerusalem",Jamaica:"America/Jamaica",Japan:"Asia/Tokyo",Kwajalein:"Pacific/Kwajalein",Libya:"Africa/Tripoli","Mexico/BajaNorte":"America/Tijuana","Mexico/BajaSur":"America/Mazatlan","Mexico/General":"America/Mexico_City",NZ:"Pacific/Auckland","NZ-CHAT":"Pacific/Chatham",Navajo:"America/Denver",PRC:"Asia/Shanghai","Pacific/Johnston":"Pacific/Honolulu","Pacific/Ponape":"Pacific/Pohnpei","Pacific/Samoa":"Pacific/Pago_Pago","Pacific/Truk":"Pacific/Chuuk","Pacific/Yap":"Pacific/Chuuk",Poland:"Europe/Warsaw",Portugal:"Europe/Lisbon",ROC:"Asia/Taipei",ROK:"Asia/Seoul",Singapore:"Asia/Singapore",Turkey:"Europe/Istanbul",UCT:"Etc/UTC","US/Alaska":"America/Anchorage","US/Aleutian":"America/Adak","US/Arizona":"America/Phoenix","US/Central":"America/Chicago","US/East-Indiana":"America/Indiana/Indianapolis","US/Eastern":"America/New_York","US/Hawaii":"Pacific/Honolulu","US/Indiana-Starke":"America/Indiana/Knox","US/Michigan":"America/Detroit","US/Mountain":"America/Denver","US/Pacific":"America/Los_Angeles","US/Samoa":"Pacific/Pago_Pago",UTC:"Etc/UTC",Universal:"Etc/UTC","W-SU":"Europe/Moscow",Zulu:"Etc/UTC"};var g=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g,v=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function p(e){var r={pattern:"",pattern12:"",skeleton:e},t=[];return r.pattern12=e.replace(/'{2}/g,"{apostrophe}").replace(/'(.*?)'/g,function(e,a){return t.push(a),"$$"+(t.length-1)+"$$"}).replace(g,function(e){var a=e.length;switch(e[0]){case"G":return r.era=4===a?"long":5===a?"narrow":"short","{era}";case"y":case"Y":case"u":case"U":case"r":return r.year=2===a?"2-digit":"numeric","{year}";case"q":case"Q":return"{quarter}";case"M":case"L":return r.month=["numeric","2-digit","short","long","narrow"][a-1],"{month}";case"w":case"W":return"{weekday}";case"d":return r.day=["numeric","2-digit"][a-1],"{day}";case"D":case"F":case"g":return r.day="numeric","{day}";case"E":return r.weekday=4===a?"long":5===a?"narrow":"short","{weekday}";case"e":return r.weekday=["numeric","2-digit","short","long","narrow","short"][a-1],"{weekday}";case"c":return r.weekday=["numeric",void 0,"short","long","narrow","short"][a-1],"{weekday}";case"a":case"b":case"B":return r.hour12=!0,"{ampm}";case"h":case"H":case"K":case"k":return r.hour=["numeric","2-digit"][a-1],"{hour}";case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":return r.minute=["numeric","2-digit"][a-1],"{minute}";case"s":return r.second=["numeric","2-digit"][a-1],"{second}";case"S":case"A":return r.second="numeric","{second}";case"z":case"Z":case"O":case"v":case"V":case"X":case"x":return r.timeZoneName=a<4?"short":"long","{timeZoneName}"}return""}),t.length&&(r.pattern12=r.pattern12.replace(/\$\$(\d+)\$\$/g,function(e,a){return t[+a]}).replace(/\{apostrophe\}/g,"'")),r.pattern=r.pattern12.replace(/([\s\uFEFF\xA0])\{ampm\}([\s\uFEFF\xA0])/,"$1").replace("{ampm}","").replace(v,""),r}var _=function(){return(_=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)},A=function(e,a){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,t=Object.getOwnPropertySymbols(e);n<t.length;n++)a.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(r[t[n]]=e[t[n]]);return r},j=Object.keys(h).reduce(function(e,a){return e[a.toUpperCase()]=h[a],e},{}),Z=["weekday","era","year","month","day","hour","minute","second","timeZoneName"],y=["locale","calendar","numberingSystem","timeZone","hourCycle","weekday","era","year","month","day","hour","minute","second","timeZoneName"],P=/^[a-z0-9]{3,8}$/i;function b(e){if(void 0===e)return NaN;if(null===e)return 0;if("boolean"==typeof e)return e?1:0;if("number"==typeof e)return e;if("symbol"==typeof e||"bigint"==typeof e)throw new TypeError("Cannot convert symbol/bigint to number");return Number(e)}function H(e){return!isFinite(e)||864e14<Math.abs(e)?NaN:function(e){var a=b(e);if(isNaN(a)||U(a,-0))return 0;if(isFinite(a))return a;var r=Math.floor(Math.abs(a));return a<0&&(r=-r),U(r,-0)?0:r}(e)}function C(e,a,r){var t=Intl.getCanonicalLocales(a),n=x(r,"any","date"),i=Object.create(null),o=E(n,"localeMatcher","string",["lookup","best fit"],"best fit");i.localeMatcher=o;var c=E(n,"calendar","string",void 0,void 0);if(void 0!==c&&!P.test(c))throw new RangeError("Malformed calendar");var u=F(e);i.ca=c;var l=E(n,"numberingSystem","string",void 0,void 0);if(void 0!==l&&!P.test(l))throw new RangeError("Malformed numbering system");i.nu=l;var s=E(n,"hour12","boolean",void 0,void 0),f=E(n,"hourCycle","string",["h11","h12","h23","h24"],void 0);void 0!==s&&(f=null),i.hc=f;var m=T(oe.getDefaultLocale)(oe.availableLocales,t,i,["nu","ca","hc"],oe.localeData);u.locale=m.locale,c=m.ca,u.calendar=c,u.hourCycle=m.hc,u.numberingSystem=m.nu;var d=m.dataLocale;u.dataLocale=d;var h,g,v,p,A=n.timeZone;if(void 0!==A){if(A=String(A),p=A.toUpperCase(),!(new Set(Object.keys(oe.tzData).map(function(e){return e.toUpperCase()})).has(p)||p in j))throw new RangeError("Invalid timeZoneName");h=A.toUpperCase(),g=Object.keys(oe.tzData).reduce(function(e,a){return e[a.toUpperCase()]=a,e},{}),A="Etc/UTC"===(v=j[h]||g[h])||"Etc/GMT"===v?"UTC":v}else A=oe.__defaultLocale;u.timeZone=A,(i=Object.create(null)).weekday=E(n,"weekday","string",["narrow","short","long"],void 0),i.era=E(n,"era","string",["narrow","short","long"],void 0),i.year=E(n,"year","string",["2-digit","numeric"],void 0),i.month=E(n,"month","string",["2-digit","numeric","narrow","short","long"],void 0),i.day=E(n,"day","string",["2-digit","numeric"],void 0),i.hour=E(n,"hour","string",["2-digit","numeric"],void 0),i.minute=E(n,"minute","string",["2-digit","numeric"],void 0),i.second=E(n,"second","string",["2-digit","numeric"],void 0),i.timeZoneName=E(n,"timeZoneName","string",["short","long"],void 0);var y,b,w,C=oe.localeData[d],O=C.formats[c],k="basic"===(o=E(n,"formatMatcher","string",["basic","best fit"],"best fit"))?function(e,a){var r=-1/0,t=a[0];L(Array.isArray(a),"formats should be a list of things");for(var n=0,i=a;n<i.length;n++){var o=i[n],c=B(e,o);r<c&&(r=c,t=o)}return _({},t)}(i,O):(i.hour12="h11"===u.hourCycle||"h12"===u.hourCycle,function(e,a){var r=-1/0,t=a[0];L(Array.isArray(a),"formats should be a list of things");for(var n=0,i=a;n<i.length;n++){var o=i[n],c=G(e,o);r<c&&(r=c,t=o)}for(var u in t=_({},t)){var l=t[u],s=e[u];"minute"!==u&&"second"!==u&&s&&(z(l)&&!z(s)||(t[u]=s))}return t}(i,O));for(var S in i){var M=k[S];void 0!==M&&(u[S]=M)}return y=void 0!==u.hour?(b=C.hourCycle,null==(w=u.hourCycle)&&(w=b),void 0!==s&&(w=s?"h11"===b||"h23"===b?"h11":"h12":(L(!s,"hour12 must not be set"),"h11"===b||"h23"===b?"h23":"h24")),"h11"===(u.hourCycle=w)||"h12"===w?k.pattern12:k.pattern):(u.hourCycle=void 0,k.pattern),u.pattern=y,e}function x(e,a,r){e=void 0===e?null:m(e),e=Object.create(e);var t=!0;if("date"===a||"any"===a)for(var n=0,i=["weekday","year","month","day"];n<i.length;n++){void 0!==e[i[n]]&&(t=!1)}if("time"===a||"any"===a)for(var o=0,c=["hour","minute","second"];o<c.length;o++){void 0!==e[c[o]]&&(t=!1)}if(t&&("date"===r||"all"===r))for(var u=0,l=["year","month","day"];u<l.length;u++){e[l[u]]="numeric"}if(t&&("time"===r||"all"===r))for(var s=0,f=["hour","minute","second"];s<f.length;s++){e[f[s]]="numeric"}return e}var O=["2-digit","numeric","narrow","short","long"],k=120,S=20,M=8,D=6,N=6,I=3;function B(e,a){for(var r=0,t=0,n=Z;t<n.length;t++){var i,o,c,u=n[t],l=e[u],s=a[u];void 0===l&&void 0!==s?r-=S:void 0!==l&&void 0===s?r-=k:l!==s&&(i=O.indexOf(l),o=O.indexOf(s),2===(c=Math.max(-2,Math.min(o-i,2)))?r-=D:1===c?r-=I:-1===c?r-=N:-2===c&&(r-=M))}return r}function G(e,a){var r=0;e.hour12&&!a.hour12?r-=k:!e.hour12&&a.hour12&&(r-=S);for(var t=0,n=Z;t<n.length;t++){var i,o,c,u=n[t],l=e[u],s=a[u];void 0===l&&void 0!==s?r-=S:void 0!==l&&void 0===s?r-=k:l!==s&&(i=O.indexOf(l),o=O.indexOf(s),2===(c=Math.max(-2,Math.min(o-i,2)))?r-=D:1===c?r-=I:-1===c?r-=N:-2===c&&(r-=M))}return r}function z(e){return"numeric"===e||"2-digit"===e}var R={enumerable:!1,configurable:!0,get:function(){if("object"!=typeof this||!(this instanceof oe))throw TypeError("Intl.DateTimeFormat format property accessor called on incompatible receiver");var e=F(this),r=this,a=e.boundFormat;if(void 0===a){a=function(e){var a=void 0===e?Date.now():Number(e);return function(e,a){for(var r=J(e,a),t="",n=0,i=r;n<i.length;n++){var o=i[n];t+=o.value}return t}(r,a)};try{Object.defineProperty(a,"name",{configurable:!0,enumerable:!1,writable:!1,value:""})}catch(e){}e.boundFormat=a}return a}};try{Object.defineProperty(R.get,"name",{configurable:!0,enumerable:!1,writable:!1,value:"get format"})}catch(e){}function K(e){return e<10?"0"+e:String(e)}function J(e,a){if(a=H(a),isNaN(a))throw new RangeError("invalid time");var r=F(e),t=r.dataLocale,n=oe.localeData[t],i=r.locale,o=Object.create(null);o.useGrouping=!1;var c=new Intl.NumberFormat(i,o),u=Object.create(null);u.minimumIntegerDigits=2,u.useGrouping=!1;for(var l,s,f,m,d,h,g,v,p,A,y,b,w=new Intl.NumberFormat(i,u),C=function(e,a,r){L("number"==typeof e,"invalid time"),L("gregory"===a,"We only support Gregory calendar right now");var t=function(e,a){var r=oe.tzData[a];if(!r)return[0,!1];for(var t=0;t<r.length;t++)if(1e3*r[t][0]>=e){var n=r[t-1],i=n[2],o=n[3];return[1e3*i,o]}return[0,!1]}(e,r),n=t[0],i=t[1],o=e+n,c=V(o);return{weekday:function(e){return($(e)+4)%7}(o),era:c<0?"BC":"AD",year:c,relatedYear:void 0,yearName:void 0,month:X(o),day:function(e){var a=q(e),r=X(e),t=Q(e);if(0===r)return a+1;if(1===r)return a-30;if(2===r)return a-58-t;if(3===r)return a-89-t;if(4===r)return a-119-t;if(5===r)return a-150-t;if(6===r)return a-180-t;if(7===r)return a-211-t;if(8===r)return a-242-t;if(9===r)return a-272-t;if(10===r)return a-303-t;if(11!==r)throw new Error("Invalid time");return a-333-t}(o),hour:function(e){var a=Math.floor(e/ie)%ee;if(U(a,-0))return 0;if(a<0)return 24+a;return a}(o),minute:function(e){var a=Math.floor(e/ne)%ae;if(U(a,-0))return 0;if(a<0)return 60+a;return a}(o),second:function(e){var a=Math.floor(e/te)%re;if(U(a,-0))return 0;if(a<0)return 60+a;return a}(o),inDST:i,timeZoneOffset:n}}(a,r.calendar,r.timeZone),O=[],k=0,S=function(e){for(var a=[],r=e.indexOf("{"),t=0,n=0,i=e.length;r<e.length&&-1<r;)L(r<(t=e.indexOf("}",r)),"Invalid pattern "+e),n<r&&a.push({type:"literal",value:e.substring(n,r)}),a.push({type:e.substring(r+1,t),value:void 0}),n=t+1,r=e.indexOf("{",n);return n<i&&a.push({type:"literal",value:e.substring(n,i)}),a}(r.pattern);k<S.length;k++){var M,E,T,_,j,P,x,D,N=S[k],I=N.type;"literal"===I?O.push({type:"literal",value:N.value}):-1<Z.indexOf(I)?(D="",M=r[I],x=C[I],"year"===I&&x<=0&&(x=1-x),"month"===I&&x++,E=r.hourCycle,"hour"!==I||"h11"!==E&&"h12"!==E||0===(x%=12)&&"h12"===E&&(x=12),"hour"===I&&"h24"===E&&0===x&&(x=24),"numeric"===M?D=c.format(x):"2-digit"===M?2<(D=w.format(x)).length&&(D=D.slice(D.length-2,D.length)):"narrow"!==M&&"short"!==M&&"long"!==M||(D="era"===I?n[I][M][x]:"timeZoneName"===I?(T=n.timeZoneName,_=n.gmtFormat,j=n.hourFormat,(P=T[r.timeZone||oe.__defaultTimeZone])&&P[M]?P[M][+C.inDST]:(l=_,s=j,f=C.timeZoneOffset,m=M,b=y=void 0,d=Math.floor(f/6e4),h=Math.abs(d)%60,g=Math.floor(Math.abs(d)/60),v=s.split(";"),p=v[0],A=v[1],y="",b=f<0?A:p,"long"===m?y=b.replace("HH",K(g)).replace("H",String(g)).replace("mm",K(h)).replace("m",String(h)):(h||g)&&(h||(b=b.replace(/:?m+/,"")),y=b.replace(/H+/,String(g)).replace(/m+/,String(h))),l.replace("{0}",y))):"month"===I?n.month[M][x-1]:n[I][M][x]),O.push({type:I,value:D})):"ampm"===I?(D=void 0,D=11<=(x=C.hour)?n.pm:n.am,O.push({type:"dayPeriod",value:D})):"relatedYear"===I?(x=C.relatedYear,D=c.format(x),O.push({type:"relatedYear",value:D})):"yearName"===I?(x=C.yearName,D=c.format(x),O.push({type:"yearName",value:D})):O.push({type:"unknown",value:a})}return O}var W=864e5;function $(e){return Math.floor(e/W)}function Y(e){return 365*(e-1970)+Math.floor((e-1969)/4)-Math.floor((e-1901)/100)+Math.floor((e-1601)/400)}function V(e){for(var a=Math.ceil(e/W/366);W*Y(a)<=e;)a++;return a-1}function q(e){return $(e)-Y(V(e))}function Q(e){return 365==((a=V(e))%4!=0||a%100==0&&a%400!=0?365:366)?0:1;var a}function X(e){var a=q(e),r=Q(e);if(0<=a&&a<31)return 0;if(a<59+r)return 1;if(a<90+r)return 2;if(a<120+r)return 3;if(a<151+r)return 4;if(a<181+r)return 5;if(a<212+r)return 6;if(a<243+r)return 7;if(a<273+r)return 8;if(a<304+r)return 9;if(a<334+r)return 10;if(a<365+r)return 11;throw new Error("Invalid time")}var ee=24,ae=60,re=60,te=1e3,ne=te*re,ie=ne*ae;var oe=function(e,a){if(!(this&&this instanceof oe))return new oe(e,a);C(this,e,a);var r=F(this).dataLocale;L(void 0!==oe.localeData[r],"Cannot load locale-dependent data for "+r+".")};a(oe,"supportedLocalesOf",{value:function(e,a){return r=oe.availableLocales,t=Intl.getCanonicalLocales(e),void 0!==(n=a)&&E(n=m(n),"localeMatcher","string",["lookup","best fit"],"best fit"),o(r,t);var r,t,n}}),a(oe.prototype,"resolvedOptions",{value:function(){if("object"!=typeof this||!(this instanceof oe))throw TypeError("Method Intl.DateTimeFormat.prototype.resolvedOptions called on incompatible receiver");for(var e=F(this),a={},r=0,t=y;r<t.length;r++){var n=t[r],i=e[n];"hourCycle"===n&&(a.hour12="h11"===i||"h12"===i||"h23"!==i&&"h24"!==i&&void 0),void 0!==i&&(a[n]=i)}return a}}),a(oe.prototype,"formatToParts",{value:function(e){return J(this,e=void 0===e?Date.now():b(e))}}),oe.__defaultTimeZone="UTC",oe.__addLocaleData=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];for(var r=0,t=e;r<t.length;r++)for(var n=t[r],i=0,o=n.availableLocales;i<o.length;i++){var c=o[i];try{var u=d(c,n),l=u.formats,s=A(u,["formats"]),f=_(_({},s),{formats:{}});for(var m in l)f.formats[m]=l[m].map(p);oe.localeData[c]=f}catch(e){}}oe.availableLocales=Object.keys(oe.localeData),oe.__defaultLocale||(oe.__defaultLocale=oe.availableLocales[0])},Object.defineProperty(oe.prototype,"format",R),oe.__defaultLocale="",oe.localeData={},oe.availableLocales=[],oe.getDefaultLocale=function(){return oe.__defaultLocale},oe.polyfilled=!0,oe.tzData={},oe.__addTZData=function(e){oe.tzData=function(e){for(var i=e.abbrvs.split("|"),o=e.offsets.split("|").map(function(e){return parseInt(e,36)}),a={},r=0,t=e.zones;r<t.length;r++){var n=t[r].split("|"),c=n[0],u=n.slice(1);a[c]=u.map(function(e){return e.split(",")}).map(function(e){var a=e[0],r=e[1],t=e[2],n=e[3];return[""===a?-1/0:parseInt(a,36),i[+r],o[+t],"1"===n]})}return a}(e)};try{"undefined"!=typeof Symbol&&Object.defineProperty(oe.prototype,Symbol.toStringTag,{value:"Intl.DateTimeFormat",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(oe.prototype.constructor,"length",{value:1,writable:!1,enumerable:!1,configurable:!0})}catch(e){}e.DateTimeFormat=oe,e.basicFormatMatcherScore=B,e.bestFitFormatMatcherScore=G,e.toDateTimeOptions=x,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((e=e||self).IntlDateTimeFormat={})}(this,function(e){"use strict";function L(e,a,r){if(void 0===r&&(r=Error),!e)throw new r(a)}function m(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}function E(e,a,r,t,n){var i=e[a];if(void 0===i)return n;if("boolean"!==r&&"string"!==r)throw new TypeError("invalid type");if("boolean"===r&&(i=Boolean(i)),"string"===r&&(i=function(e){if("symbol"==typeof e)throw TypeError("Cannot convert a Symbol value to a string");return String(e)}(i)),void 0!==t&&!t.filter(function(e){return e==i}).length)throw new RangeError(i+" is not within "+t.join(", "));return i}function t(e,a){return Object.is?Object.is(e,a):e===a?0!==e||1/e==1/a:e!=e&&a!=a}["angle-degree","area-acre","area-hectare","concentr-percent","digital-bit","digital-byte","digital-gigabit","digital-gigabyte","digital-kilobit","digital-kilobyte","digital-megabit","digital-megabyte","digital-petabyte","digital-terabit","digital-terabyte","duration-day","duration-hour","duration-millisecond","duration-minute","duration-month","duration-second","duration-week","duration-year","length-centimeter","length-foot","length-inch","length-kilometer","length-meter","length-mile-scandinavian","length-mile","length-millimeter","length-yard","mass-gram","mass-kilogram","mass-ounce","mass-pound","mass-stone","temperature-celsius","temperature-fahrenheit","volume-fluid-ounce","volume-gallon","volume-liter","volume-milliliter"].map(function(e){return e.replace(/^(.*?)-/,"")});function a(e,a,r){var t=r.value;Object.defineProperty(e,a,{configurable:!0,enumerable:!1,writable:!0,value:t})}var n,r=(n=function(e,a){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,a){e.__proto__=a}||function(e,a){for(var r in a)a.hasOwnProperty(r)&&(e[r]=a[r])})(e,a)},function(e,a){function r(){this.constructor=e}n(e,a),e.prototype=null===a?Object.create(a):(r.prototype=a.prototype,new r)}),i=function(){return(i=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)};function T(e){var u,l,y=function(e,a){for(var r={locale:""},t=0,n=a;t<n.length;t++){var i=n[t],o=i.replace(s,""),c=f(e,o);if(c)return r.locale=c,i!==o&&(r.extension=i.slice(o.length+1,i.length)),r}return r.locale=u(),r},b=(l=u=e,function(e,a){for(var r={locale:""},t=0,n=a;t<n.length;t++){var i=n[t],o=i.replace(s,""),c=f(e,o);if(c)return r.locale=c,i!==o&&(r.extension=i.slice(o.length+1,i.length)),r}return r.locale=l(),r});return function(e,a,r,t,n){for(var i,o=("lookup"===r.localeMatcher?y:b)(e,a),c=o.locale,u={locale:"",dataLocale:c},l="-u",s=0,f=t;s<f.length;s++){var m=f[s],d=n[c];L("object"==typeof d&&null!==d,"locale data "+m+" must be an object");var h=d[m];L(Array.isArray(h),"keyLocaleData for "+m+" must be an array");var g=h[0];L("string"==typeof g||null===g,"value must be string or null but got "+typeof g+" in key "+m);var v,p,A="";!o.extension||void 0!==(v=w(o.extension,m))&&(""!==v?~h.indexOf(v)&&(A="-"+m+"-"+(g=v)):~v.indexOf("true")&&(g="true",A="-"+m)),m in r&&(L("string"==typeof(p=r[m])||null==p,"optionsValue must be String, Undefined or Null"),~h.indexOf(p)&&p!==g&&(g=p,A="")),u[m]=g,l+=A}return 2<l.length&&(-1===(i=c.indexOf("-x-"))?c+=l:c=c.slice(0,i)+l+c.slice(i,c.length),c=Intl.getCanonicalLocales(c)[0]),u.locale=c,u}}function w(e,a){L(2===a.length,"key must have 2 elements");var r=e.length,t="-"+a+"-",n=e.indexOf(t);if(-1!==n){for(var i=n+4,o=i,c=i,u=!1;!u;){var l=e.indexOf("-",c);2===(-1===l?r-c:l-c)?u=!0:-1===l?(o=r,u=!0):c=(o=l)+1}return e.slice(i,o)}if(t="-"+a,-1!==(n=e.indexOf(t))&&n+3===r)return""}var s=/-u(?:-[0-9a-z]{2,8})+/gi;function f(e,a){for(var r=a;;){if(~e.indexOf(r))return r;var t=r.lastIndexOf("-");if(!~t)return;2<=t&&"-"===r[t-2]&&(t-=2),r=r.slice(0,t)}}function o(e,a){for(var r=[],t=0,n=a;t<n.length;t++){var i=f(e,n[t].replace(s,""));i&&r.push(i)}return r}var c,u=(c=Error,r(l,c),l);function l(){var e=null!==c&&c.apply(this,arguments)||this;return e.type="MISSING_LOCALE_DATA",e}function d(e,a,r){void 0===r&&(r=function(e,a){return i(i({},e),a)});var t=function(e){for(var a=[e],r=e.split("-"),t=r.length;1<t;t--)a.push(r.slice(0,t-1).join("-"));return a}(e),n=t.map(function(e){return a.data[e]}).filter(Boolean);if(!n.length)throw new u('Missing locale data for "'+e+'", lookup hierarchy: '+t.join(", "));return n.reverse(),n.reduce(r,{})}var h=new WeakMap;function U(e){var a=h.get(e);return a||(a=Object.create(null),h.set(e,a)),a}var g={"Africa/Asmera":"Africa/Nairobi","Africa/Timbuktu":"Africa/Abidjan","America/Argentina/ComodRivadavia":"America/Argentina/Catamarca","America/Atka":"America/Adak","America/Buenos_Aires":"America/Argentina/Buenos_Aires","America/Catamarca":"America/Argentina/Catamarca","America/Coral_Harbour":"America/Atikokan","America/Cordoba":"America/Argentina/Cordoba","America/Ensenada":"America/Tijuana","America/Fort_Wayne":"America/Indiana/Indianapolis","America/Godthab":"America/Nuuk","America/Indianapolis":"America/Indiana/Indianapolis","America/Jujuy":"America/Argentina/Jujuy","America/Knox_IN":"America/Indiana/Knox","America/Louisville":"America/Kentucky/Louisville","America/Mendoza":"America/Argentina/Mendoza","America/Montreal":"America/Toronto","America/Porto_Acre":"America/Rio_Branco","America/Rosario":"America/Argentina/Cordoba","America/Santa_Isabel":"America/Tijuana","America/Shiprock":"America/Denver","America/Virgin":"America/Port_of_Spain","Antarctica/South_Pole":"Pacific/Auckland","Asia/Ashkhabad":"Asia/Ashgabat","Asia/Calcutta":"Asia/Kolkata","Asia/Chongqing":"Asia/Shanghai","Asia/Chungking":"Asia/Shanghai","Asia/Dacca":"Asia/Dhaka","Asia/Harbin":"Asia/Shanghai","Asia/Kashgar":"Asia/Urumqi","Asia/Katmandu":"Asia/Kathmandu","Asia/Macao":"Asia/Macau","Asia/Rangoon":"Asia/Yangon","Asia/Saigon":"Asia/Ho_Chi_Minh","Asia/Tel_Aviv":"Asia/Jerusalem","Asia/Thimbu":"Asia/Thimphu","Asia/Ujung_Pandang":"Asia/Makassar","Asia/Ulan_Bator":"Asia/Ulaanbaatar","Atlantic/Faeroe":"Atlantic/Faroe","Atlantic/Jan_Mayen":"Europe/Oslo","Australia/ACT":"Australia/Sydney","Australia/Canberra":"Australia/Sydney","Australia/LHI":"Australia/Lord_Howe","Australia/NSW":"Australia/Sydney","Australia/North":"Australia/Darwin","Australia/Queensland":"Australia/Brisbane","Australia/South":"Australia/Adelaide","Australia/Tasmania":"Australia/Hobart","Australia/Victoria":"Australia/Melbourne","Australia/West":"Australia/Perth","Australia/Yancowinna":"Australia/Broken_Hill","Brazil/Acre":"America/Rio_Branco","Brazil/DeNoronha":"America/Noronha","Brazil/East":"America/Sao_Paulo","Brazil/West":"America/Manaus","Canada/Atlantic":"America/Halifax","Canada/Central":"America/Winnipeg","Canada/Eastern":"America/Toronto","Canada/Mountain":"America/Edmonton","Canada/Newfoundland":"America/St_Johns","Canada/Pacific":"America/Vancouver","Canada/Saskatchewan":"America/Regina","Canada/Yukon":"America/Whitehorse","Chile/Continental":"America/Santiago","Chile/EasterIsland":"Pacific/Easter",Cuba:"America/Havana",Egypt:"Africa/Cairo",Eire:"Europe/Dublin","Etc/UCT":"Etc/UTC","Europe/Belfast":"Europe/London","Europe/Tiraspol":"Europe/Chisinau",GB:"Europe/London","GB-Eire":"Europe/London","GMT+0":"Etc/GMT","GMT-0":"Etc/GMT",GMT0:"Etc/GMT",Greenwich:"Etc/GMT",Hongkong:"Asia/Hong_Kong",Iceland:"Atlantic/Reykjavik",Iran:"Asia/Tehran",Israel:"Asia/Jerusalem",Jamaica:"America/Jamaica",Japan:"Asia/Tokyo",Kwajalein:"Pacific/Kwajalein",Libya:"Africa/Tripoli","Mexico/BajaNorte":"America/Tijuana","Mexico/BajaSur":"America/Mazatlan","Mexico/General":"America/Mexico_City",NZ:"Pacific/Auckland","NZ-CHAT":"Pacific/Chatham",Navajo:"America/Denver",PRC:"Asia/Shanghai","Pacific/Johnston":"Pacific/Honolulu","Pacific/Ponape":"Pacific/Pohnpei","Pacific/Samoa":"Pacific/Pago_Pago","Pacific/Truk":"Pacific/Chuuk","Pacific/Yap":"Pacific/Chuuk",Poland:"Europe/Warsaw",Portugal:"Europe/Lisbon",ROC:"Asia/Taipei",ROK:"Asia/Seoul",Singapore:"Asia/Singapore",Turkey:"Europe/Istanbul",UCT:"Etc/UTC","US/Alaska":"America/Anchorage","US/Aleutian":"America/Adak","US/Arizona":"America/Phoenix","US/Central":"America/Chicago","US/East-Indiana":"America/Indiana/Indianapolis","US/Eastern":"America/New_York","US/Hawaii":"Pacific/Honolulu","US/Indiana-Starke":"America/Indiana/Knox","US/Michigan":"America/Detroit","US/Mountain":"America/Denver","US/Pacific":"America/Los_Angeles","US/Samoa":"Pacific/Pago_Pago",UTC:"Etc/UTC",Universal:"Etc/UTC","W-SU":"Europe/Moscow",Zulu:"Etc/UTC"};var v=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g,p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function A(e){var r={pattern:"",pattern12:"",skeleton:e},t=[];return r.pattern12=e.replace(/'{2}/g,"{apostrophe}").replace(/'(.*?)'/g,function(e,a){return t.push(a),"$$"+(t.length-1)+"$$"}).replace(v,function(e){var a=e.length;switch(e[0]){case"G":return r.era=4===a?"long":5===a?"narrow":"short","{era}";case"y":case"Y":case"u":case"U":case"r":return r.year=2===a?"2-digit":"numeric","{year}";case"q":case"Q":return"{quarter}";case"M":case"L":return r.month=["numeric","2-digit","short","long","narrow"][a-1],"{month}";case"w":case"W":return"{weekday}";case"d":return r.day=["numeric","2-digit"][a-1],"{day}";case"D":case"F":case"g":return r.day="numeric","{day}";case"E":return r.weekday=4===a?"long":5===a?"narrow":"short","{weekday}";case"e":return r.weekday=["numeric","2-digit","short","long","narrow","short"][a-1],"{weekday}";case"c":return r.weekday=["numeric",void 0,"short","long","narrow","short"][a-1],"{weekday}";case"a":case"b":case"B":return r.hour12=!0,"{ampm}";case"h":case"H":case"K":case"k":return r.hour=["numeric","2-digit"][a-1],"{hour}";case"j":case"J":case"C":throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case"m":return r.minute=["numeric","2-digit"][a-1],"{minute}";case"s":return r.second=["numeric","2-digit"][a-1],"{second}";case"S":case"A":return r.second="numeric","{second}";case"z":case"Z":case"O":case"v":case"V":case"X":case"x":return r.timeZoneName=a<4?"short":"long","{timeZoneName}"}return""}),t.length&&(r.pattern12=r.pattern12.replace(/\$\$(\d+)\$\$/g,function(e,a){return t[+a]}).replace(/\{apostrophe\}/g,"'")),r.pattern=r.pattern12.replace(/([\s\uFEFF\xA0])\{ampm\}([\s\uFEFF\xA0])/,"$1").replace("{ampm}","").replace(p,""),r}var _=function(){return(_=Object.assign||function(e){for(var a,r=1,t=arguments.length;r<t;r++)for(var n in a=arguments[r])Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);return e}).apply(this,arguments)},y=function(e,a){var r={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(r[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,t=Object.getOwnPropertySymbols(e);n<t.length;n++)a.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(r[t[n]]=e[t[n]]);return r},j=Object.keys(g).reduce(function(e,a){return e[a.toUpperCase()]=g[a],e},{}),F=["weekday","era","year","month","day","hour","minute","second","timeZoneName"],b=["locale","calendar","numberingSystem","timeZone","hourCycle","weekday","era","year","month","day","hour","minute","second","timeZoneName"],P=/^[a-z0-9]{3,8}$/i;function C(e){if(void 0===e)return NaN;if(null===e)return 0;if("boolean"==typeof e)return e?1:0;if("number"==typeof e)return e;if("symbol"==typeof e||"bigint"==typeof e)throw new TypeError("Cannot convert symbol/bigint to number");return Number(e)}function Z(e){return!isFinite(e)||864e14<Math.abs(e)?NaN:function(e){var a=C(e);if(isNaN(a)||t(a,-0))return 0;if(isFinite(a))return a;var r=Math.floor(Math.abs(a));return a<0&&(r=-r),t(r,-0)?0:r}(e)}function O(e,a,r){var t=Intl.getCanonicalLocales(a),n=x(r,"any","date"),i=Object.create(null),o=E(n,"localeMatcher","string",["lookup","best fit"],"best fit");i.localeMatcher=o;var c=E(n,"calendar","string",void 0,void 0);if(void 0!==c&&!P.test(c))throw new RangeError("Malformed calendar");var u=U(e);i.ca=c;var l=E(n,"numberingSystem","string",void 0,void 0);if(void 0!==l&&!P.test(l))throw new RangeError("Malformed numbering system");i.nu=l;var s=E(n,"hour12","boolean",void 0,void 0),f=E(n,"hourCycle","string",["h11","h12","h23","h24"],void 0);void 0!==s&&(f=null),i.hc=f;var m=T(ce.getDefaultLocale)(ce.availableLocales,t,i,["nu","ca","hc"],ce.localeData);u.locale=m.locale,c=m.ca,u.calendar=c,u.hourCycle=m.hc,u.numberingSystem=m.nu;var d=m.dataLocale;u.dataLocale=d;var h,g,v,p,A=n.timeZone;if(void 0!==A){if(A=String(A),p=A.toUpperCase(),!(new Set(Object.keys(ce.tzData).map(function(e){return e.toUpperCase()})).has(p)||p in j))throw new RangeError("Invalid timeZoneName");h=A.toUpperCase(),g=Object.keys(ce.tzData).reduce(function(e,a){return e[a.toUpperCase()]=a,e},{}),A="Etc/UTC"===(v=j[h]||g[h])||"Etc/GMT"===v?"UTC":v}else A=ce.__defaultLocale;u.timeZone=A,(i=Object.create(null)).weekday=E(n,"weekday","string",["narrow","short","long"],void 0),i.era=E(n,"era","string",["narrow","short","long"],void 0),i.year=E(n,"year","string",["2-digit","numeric"],void 0),i.month=E(n,"month","string",["2-digit","numeric","narrow","short","long"],void 0),i.day=E(n,"day","string",["2-digit","numeric"],void 0),i.hour=E(n,"hour","string",["2-digit","numeric"],void 0),i.minute=E(n,"minute","string",["2-digit","numeric"],void 0),i.second=E(n,"second","string",["2-digit","numeric"],void 0),i.timeZoneName=E(n,"timeZoneName","string",["short","long"],void 0);var y,b,w,C=ce.localeData[d],O=C.formats[c],k="basic"===(o=E(n,"formatMatcher","string",["basic","best fit"],"best fit"))?function(e,a){var r=-1/0,t=a[0];L(Array.isArray(a),"formats should be a list of things");for(var n=0,i=a;n<i.length;n++){var o=i[n],c=B(e,o);r<c&&(r=c,t=o)}return _({},t)}(i,O):(i.hour12="h11"===u.hourCycle||"h12"===u.hourCycle,function(e,a){var r=-1/0,t=a[0];L(Array.isArray(a),"formats should be a list of things");for(var n=0,i=a;n<i.length;n++){var o=i[n],c=G(e,o);r<c&&(r=c,t=o)}for(var u in t=_({},t)){var l=t[u],s=e[u];"minute"!==u&&"second"!==u&&s&&(z(l)&&!z(s)||(t[u]=s))}return t}(i,O));for(var M in i){var S=k[M];void 0!==S&&(u[M]=S)}return y=void 0!==u.hour?(b=C.hourCycle,null==(w=u.hourCycle)&&(w=b),void 0!==s&&(w=s?"h11"===b||"h23"===b?"h11":"h12":(L(!s,"hour12 must not be set"),"h11"===b||"h23"===b?"h23":"h24")),"h11"===(u.hourCycle=w)||"h12"===w?k.pattern12:k.pattern):(u.hourCycle=void 0,k.pattern),u.pattern=y,e}function x(e,a,r){e=void 0===e?null:m(e),e=Object.create(e);var t=!0;if("date"===a||"any"===a)for(var n=0,i=["weekday","year","month","day"];n<i.length;n++){void 0!==e[i[n]]&&(t=!1)}if("time"===a||"any"===a)for(var o=0,c=["hour","minute","second"];o<c.length;o++){void 0!==e[c[o]]&&(t=!1)}if(t&&("date"===r||"all"===r))for(var u=0,l=["year","month","day"];u<l.length;u++){e[l[u]]="numeric"}if(t&&("time"===r||"all"===r))for(var s=0,f=["hour","minute","second"];s<f.length;s++){e[f[s]]="numeric"}return e}var k=["2-digit","numeric","narrow","short","long"],M=120,S=20,D=8,N=6,I=6,H=3;function B(e,a){for(var r=0,t=0,n=F;t<n.length;t++){var i,o,c,u=n[t],l=e[u],s=a[u];void 0===l&&void 0!==s?r-=S:void 0!==l&&void 0===s?r-=M:l!==s&&(i=k.indexOf(l),o=k.indexOf(s),2===(c=Math.max(-2,Math.min(o-i,2)))?r-=N:1===c?r-=H:-1===c?r-=I:-2===c&&(r-=D))}return r}function G(e,a){var r=0;e.hour12&&!a.hour12?r-=M:!e.hour12&&a.hour12&&(r-=S);for(var t=0,n=F;t<n.length;t++){var i,o,c,u=n[t],l=e[u],s=a[u];void 0===l&&void 0!==s?r-=S:void 0!==l&&void 0===s?r-=M:l!==s&&(i=k.indexOf(l),o=k.indexOf(s),2===(c=Math.max(-2,Math.min(o-i,2)))?r-=N:1===c?r-=H:-1===c?r-=I:-2===c&&(r-=D))}return r}function z(e){return"numeric"===e||"2-digit"===e}var R={enumerable:!1,configurable:!0,get:function(){if("object"!=typeof this||!(this instanceof ce))throw TypeError("Intl.DateTimeFormat format property accessor called on incompatible receiver");var e=U(this),r=this,a=e.boundFormat;if(void 0===a){a=function(e){var a=void 0===e?Date.now():Number(e);return function(e,a){for(var r=J(e,a),t="",n=0,i=r;n<i.length;n++){var o=i[n];t+=o.value}return t}(r,a)};try{Object.defineProperty(a,"name",{configurable:!0,enumerable:!1,writable:!1,value:""})}catch(e){}e.boundFormat=a}return a}};try{Object.defineProperty(R.get,"name",{configurable:!0,enumerable:!1,writable:!1,value:"get format"})}catch(e){}function K(e){return e<10?"0"+e:String(e)}function J(e,a){if(a=Z(a),isNaN(a))throw new RangeError("invalid time");var r=U(e),t=r.dataLocale,n=ce.localeData[t],i=r.locale,o=Object.create(null);o.useGrouping=!1;var c=new Intl.NumberFormat(i,o),u=Object.create(null);u.minimumIntegerDigits=2,u.useGrouping=!1;for(var l,s,f,m,d,h,g,v,p,A,y,b,w=new Intl.NumberFormat(i,u),C=function(e,a,r){L("number"==typeof e,"invalid time"),L("gregory"===a,"We only support Gregory calendar right now");var t=function(e,a){var r=ce.tzData[a];if(!r)return[0,!1];for(var t=0;t<r.length;t++)if(1e3*r[t][0]>=e){var n=r[t-1],i=n[2],o=n[3];return[1e3*i,o]}return[0,!1]}(e,r),n=t[0],i=t[1],o=e+n,c=q(o);return{weekday:function(e){return $(Y(e)+4,7)}(o),era:c<0?"BC":"AD",year:c,relatedYear:void 0,yearName:void 0,month:ee(o),day:function(e){var a=Q(e),r=ee(e),t=X(e);if(0===r)return a+1;if(1===r)return a-30;if(2===r)return a-58-t;if(3===r)return a-89-t;if(4===r)return a-119-t;if(5===r)return a-150-t;if(6===r)return a-180-t;if(7===r)return a-211-t;if(8===r)return a-242-t;if(9===r)return a-272-t;if(10===r)return a-303-t;if(11!==r)throw new Error("Invalid time");return a-333-t}(o),hour:function(e){return $(Math.floor(e/oe),ae)}(o),minute:function(e){return $(Math.floor(e/ie),re)}(o),second:function(e){return $(Math.floor(e/ne),te)}(o),inDST:i,timeZoneOffset:n}}(a,r.calendar,r.timeZone),O=[],k=0,M=function(e){for(var a=[],r=e.indexOf("{"),t=0,n=0,i=e.length;r<e.length&&-1<r;)L(r<(t=e.indexOf("}",r)),"Invalid pattern "+e),n<r&&a.push({type:"literal",value:e.substring(n,r)}),a.push({type:e.substring(r+1,t),value:void 0}),n=t+1,r=e.indexOf("{",n);return n<i&&a.push({type:"literal",value:e.substring(n,i)}),a}(r.pattern);k<M.length;k++){var S,E,T,_,j,P,x,D,N=M[k],I=N.type;"literal"===I?O.push({type:"literal",value:N.value}):-1<F.indexOf(I)?(D="",S=r[I],x=C[I],"year"===I&&x<=0&&(x=1-x),"month"===I&&x++,E=r.hourCycle,"hour"!==I||"h11"!==E&&"h12"!==E||0===(x%=12)&&"h12"===E&&(x=12),"hour"===I&&"h24"===E&&0===x&&(x=24),"numeric"===S?D=c.format(x):"2-digit"===S?2<(D=w.format(x)).length&&(D=D.slice(D.length-2,D.length)):"narrow"!==S&&"short"!==S&&"long"!==S||(D="era"===I?n[I][S][x]:"timeZoneName"===I?(T=n.timeZoneName,_=n.gmtFormat,j=n.hourFormat,(P=T[r.timeZone||ce.__defaultTimeZone])&&P[S]?P[S][+C.inDST]:(l=_,s=j,f=C.timeZoneOffset,m=S,b=y=void 0,d=Math.floor(f/6e4),h=Math.abs(d)%60,g=Math.floor(Math.abs(d)/60),v=s.split(";"),p=v[0],A=v[1],y="",b=f<0?A:p,"long"===m?y=b.replace("HH",K(g)).replace("H",String(g)).replace("mm",K(h)).replace("m",String(h)):(h||g)&&(h||(b=b.replace(/:?m+/,"")),y=b.replace(/H+/,String(g)).replace(/m+/,String(h))),l.replace("{0}",y))):"month"===I?n.month[S][x-1]:n[I][S][x]),O.push({type:I,value:D})):"ampm"===I?(D=void 0,D=11<=(x=C.hour)?n.pm:n.am,O.push({type:"dayPeriod",value:D})):"relatedYear"===I?(x=C.relatedYear,D=c.format(x),O.push({type:"relatedYear",value:D})):"yearName"===I?(x=C.yearName,D=c.format(x),O.push({type:"yearName",value:D})):O.push({type:"unknown",value:a})}return O}var W=864e5;function $(e,a){return e-Math.floor(e/a)*a}function Y(e){return Math.floor(e/W)}function V(e){return 365*(e-1970)+Math.floor((e-1969)/4)-Math.floor((e-1901)/100)+Math.floor((e-1601)/400)}function q(e){for(var a=Math.ceil(e/W/366);W*V(a)<=e;)a++;return a-1}function Q(e){return Y(e)-V(q(e))}function X(e){return 365==((a=q(e))%4!=0||a%100==0&&a%400!=0?365:366)?0:1;var a}function ee(e){var a=Q(e),r=X(e);if(0<=a&&a<31)return 0;if(a<59+r)return 1;if(a<90+r)return 2;if(a<120+r)return 3;if(a<151+r)return 4;if(a<181+r)return 5;if(a<212+r)return 6;if(a<243+r)return 7;if(a<273+r)return 8;if(a<304+r)return 9;if(a<334+r)return 10;if(a<365+r)return 11;throw new Error("Invalid time")}var ae=24,re=60,te=60,ne=1e3,ie=ne*te,oe=ie*re;var ce=function(e,a){if(!(this&&this instanceof ce))return new ce(e,a);O(this,e,a);var r=U(this).dataLocale;L(void 0!==ce.localeData[r],"Cannot load locale-dependent data for "+r+".")};a(ce,"supportedLocalesOf",{value:function(e,a){return r=ce.availableLocales,t=Intl.getCanonicalLocales(e),void 0!==(n=a)&&E(n=m(n),"localeMatcher","string",["lookup","best fit"],"best fit"),o(r,t);var r,t,n}}),a(ce.prototype,"resolvedOptions",{value:function(){if("object"!=typeof this||!(this instanceof ce))throw TypeError("Method Intl.DateTimeFormat.prototype.resolvedOptions called on incompatible receiver");for(var e=U(this),a={},r=0,t=b;r<t.length;r++){var n=t[r],i=e[n];"hourCycle"===n&&(a.hour12="h11"===i||"h12"===i||"h23"!==i&&"h24"!==i&&void 0),void 0!==i&&(a[n]=i)}return a}}),a(ce.prototype,"formatToParts",{value:function(e){return J(this,e=void 0===e?Date.now():C(e))}}),ce.__defaultTimeZone="UTC",ce.__addLocaleData=function(){for(var e=[],a=0;a<arguments.length;a++)e[a]=arguments[a];for(var r=0,t=e;r<t.length;r++)for(var n=t[r],i=0,o=n.availableLocales;i<o.length;i++){var c=o[i];try{var u=d(c,n),l=u.formats,s=y(u,["formats"]),f=_(_({},s),{formats:{}});for(var m in l)f.formats[m]=l[m].map(A);ce.localeData[c]=f}catch(e){}}ce.availableLocales=Object.keys(ce.localeData),ce.__defaultLocale||(ce.__defaultLocale=ce.availableLocales[0])},Object.defineProperty(ce.prototype,"format",R),ce.__defaultLocale="",ce.localeData={},ce.availableLocales=[],ce.getDefaultLocale=function(){return ce.__defaultLocale},ce.polyfilled=!0,ce.tzData={},ce.__addTZData=function(e){ce.tzData=function(e){for(var i=e.abbrvs.split("|"),o=e.offsets.split("|").map(function(e){return parseInt(e,36)}),a={},r=0,t=e.zones;r<t.length;r++){var n=t[r].split("|"),c=n[0],u=n.slice(1);a[c]=u.map(function(e){return e.split(",")}).map(function(e){var a=e[0],r=e[1],t=e[2],n=e[3];return[""===a?-1/0:parseInt(a,36),i[+r],o[+t],"1"===n]})}return a}(e)};try{"undefined"!=typeof Symbol&&Object.defineProperty(ce.prototype,Symbol.toStringTag,{value:"Intl.DateTimeFormat",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(ce.prototype.constructor,"length",{value:1,writable:!1,enumerable:!1,configurable:!0})}catch(e){}e.DateTimeFormat=ce,e.basicFormatMatcherScore=B,e.bestFitFormatMatcherScore=G,e.toDateTimeOptions=x,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=intl-datetimeformat.min.js.map
|