0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 15:09:10 -05:00
penpot/frontend/vendor/datefns/datefns.bundle.min.js

1 line
9.9 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t=function(e){var t=new Date(e.getTime()),n=t.getTimezoneOffset();return t.setSeconds(0,0),6e4*n+t.getTime()%6e4};var n=function(e){return e instanceof Date},r=36e5,a=6e4,o=2,u=/[T ]/,i=/:/,s=/^(\d{2})$/,f=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],c=/^(\d{4})/,l=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],d=/^-(\d{2})$/,g=/^-?(\d{3})$/,h=/^-?(\d{2})-?(\d{2})$/,v=/^-?W(\d{2})$/,m=/^-?W(\d{2})-?(\d{1})$/,D=/^(\d{2}([.,]\d*)?)$/,M=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,T=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,p=/([Z+-].*)$/,y=/^(Z)$/,S=/^([+-])(\d{2})$/,x=/^([+-])(\d{2}):?(\d{2})$/;function Y(e,t,n){t=t||0,n=n||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var a=7*t+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}var w=function(e,w){if(n(e))return new Date(e.getTime());if("string"!=typeof e)return new Date(e);var b=(w||{}).additionalDigits;b=null==b?o:Number(b);var F=function(e){var t,n={},r=e.split(u);i.test(r[0])?(n.date=null,t=r[0]):(n.date=r[0],t=r[1]);if(t){var a=p.exec(t);a?(n.time=t.replace(a[1],""),n.timezone=a[1]):n.time=t}return n}(e),H=function(e,t){var n,r=f[t],a=l[t];if(n=c.exec(e)||a.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=s.exec(e)||r.exec(e)){var u=n[1];return{year:100*parseInt(u,10),restDateString:e.slice(u.length)}}return{year:null}}(F.date,b),I=H.year,X=function(e,t){if(null===t)return null;var n,r,a,o;if(0===e.length)return(r=new Date(0)).setUTCFullYear(t),r;if(n=d.exec(e))return r=new Date(0),a=parseInt(n[1],10)-1,r.setUTCFullYear(t,a),r;if(n=g.exec(e)){r=new Date(0);var u=parseInt(n[1],10);return r.setUTCFullYear(t,0,u),r}if(n=h.exec(e)){r=new Date(0),a=parseInt(n[1],10)-1;var i=parseInt(n[2],10);return r.setUTCFullYear(t,a,i),r}if(n=v.exec(e))return o=parseInt(n[1],10)-1,Y(t,o);if(n=m.exec(e)){o=parseInt(n[1],10)-1;var s=parseInt(n[2],10)-1;return Y(t,o,s)}return null}(H.restDateString,I);if(X){var W,$=X.getTime(),z=0;if(F.time&&(z=function(e){var t,n,o;if(t=D.exec(e))return(n=parseFloat(t[1].replace(",",".")))%24*r;if(t=M.exec(e))return n=parseInt(t[1],10),o=parseFloat(t[2].replace(",",".")),n%24*r+o*a;if(t=T.exec(e)){n=parseInt(t[1],10),o=parseInt(t[2],10);var u=parseFloat(t[3].replace(",","."));return n%24*r+o*a+1e3*u}return null}(F.time)),F.timezone)W=function(e){var t,n;if(t=y.exec(e))return 0;if(t=S.exec(e))return n=60*parseInt(t[2],10),"+"===t[1]?-n:n;if(t=x.exec(e))return n=60*parseInt(t[2],10)+parseInt(t[3],10),"+"===t[1]?-n:n;return 0}(F.timezone)*a;else{var G=$+z,O=new Date(G);W=t(O);var E=new Date(G);E.setDate(O.getDate()+1);var Z=t(E)-t(O);Z>0&&(W+=Z)}return new Date($+z+W)}return new Date(e)};var b=function(e){var t=w(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n};var F=function(e){var t=w(e);return t.setHours(0,0,0,0),t},H=6e4,I=864e5;var X=function(e,t){var n=F(e),r=F(t),a=n.getTime()-n.getTimezoneOffset()*H,o=r.getTime()-r.getTimezoneOffset()*H;return Math.round((a-o)/I)};var W=function(e){var t=w(e);return X(t,b(t))+1};var $=function(e,t){var n=t&&Number(t.weekStartsOn)||0,r=w(e),a=r.getDay(),o=(a<n?7:0)+a-n;return r.setDate(r.getDate()-o),r.setHours(0,0,0,0),r};var z=function(e){return $(e,{weekStartsOn:1})};var G=function(e){var t=w(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var a=z(r),o=new Date(0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);var u=z(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=u.getTime()?n:n-1};var O=function(e){var t=G(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),z(n)},E=6048e5;var Z=function(e){var t=w(e),n=z(t).getTime()-O(t).getTime();return Math.round(n/E)+1};var A=function(e){if(n(e))return!isNaN(e);throw new TypeError(toString.call(e)+" is not an instance of Date")};var C=["M","MM","Q","D","DD","DDD","DDDD","d","E","W","WW","YY","YYYY","GG","GGGG","H","HH","h","hh","m","mm","s","ss","S","SS","SSS","Z","ZZ","X","x"];var U=function(e){var t=[];for(var n in e)e.hasOwnPropert