UNPKG

@js-sugar/date

Version:

A multi-calendar, tree-shakable, extensible, immutable and lightweight date library for JavaScript

1 lines 2.23 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["jss-date"]=t():e["jss-date"]=t()}(this,(function(){return(this.webpackChunkjss_date=this.webpackChunkjss_date||[]).push([[668,695,866],{891:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Formats:()=>r,format:()=>m});var s=n(913),o=n(603);const a=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|f{1,3}|c{1,2}|C{1,3}|a|A|z{1,3}|Z{1,3}/g;var r;function m(e,t,n){const{calendar:r,zone:m,locale:i,year:h,month:c,day:u,hour:d,minute:f,second:M,ms:l,ts:g}=e;let p,Y,y=(0,s.weekDay)(e),k=((0,o.weekDayLocale)(e),m.getOffset(g));const b={o:k,p:k>=0,s:k>=0?"+":"-",hr:Math.abs(Math.floor(k/60)),min:Math.abs(Math.floor(k%60))},z=(e,t=1)=>i.formatNumber(0===e?0:e,{minimumIntegerDigits:t}),w={Y:()=>z(h),YY:()=>z(h,4).substring(2),YYYY:()=>z(h,4),M:()=>z(c),MM:()=>z(c,4).substring(2),MMM:()=>(p||(p=i.getMonthNames(r,"short"),(null==n?void 0:n.shortMonthNameMaxLength)&&(p=p.map((e=>e.substring(0,n.shortMonthNameMaxLength))))),p[c-1]),MMMM:()=>(Y||(Y=i.getMonthNames(r,"long"),(null==n?void 0:n.longMonthNameMaxLength)&&(Y=Y.map((e=>e.substring(0,n.longMonthNameMaxLength))))),Y[c-1]),d:()=>z(u),dd:()=>z(u,2),H:()=>z(d),HH:()=>z(d,2),h:()=>z(d%12),hh:()=>z(d%12,2),m:()=>z(f),mm:()=>z(f,2),s:()=>z(M),ss:()=>z(M,2),f:()=>z(l),fff:()=>z(l,3),c:()=>z(y),cc:()=>z(y),C:()=>i.getWeekdayNames("narrow")[y],CC:()=>i.getWeekdayNames("short")[y],CCC:()=>i.getWeekdayNames("long")[y],z:()=>{const e=z(b.o);return b.p?`+${e}`:e},zz:()=>`${b.s}${z(b.hr,2)}:${z(b.min,2)}`,zzz:()=>`${b.s}${z(b.hr,2)}${z(b.min,2)}`,Z:()=>m.name,ZZ:()=>i.getZoneTitle(m.name,"short"),ZZZ:()=>i.getZoneTitle(m.name,"long")};return t.replace(a,((e,t)=>{let n;return n=t||(w[e]?w[e]():e),n}))}!function(e){e.iso="YYYY-MM-ddTHH:mm:ss.fffzz",e.isoDate="YYYY-MM-dd"}(r||(r={}))},603:(e,t,n)=>{"use strict";function s(e){return(e.locale.weekStart+e.calendar.weekDay(e.ts))%7}n.r(t),n.d(t,{weekDayLocale:()=>s})},913:(e,t,n)=>{"use strict";function s(e){return e.calendar.weekDay(e.ts+1e3*e.zone.getOffset(e.ts)*60)}n.r(t),n.d(t,{weekDay:()=>s})}},e=>{"use strict";var t;return t=891,e(e.s=t)}])}));