UNPKG

@stdlib/esm

Version:

ES module distribution for Stdlib, a standard library for JavaScript and Node.js.

3 lines 1.89 kB
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 import e from"./../assert/is-date-object.js";import r from"./../assert/is-string.js";import t from"./../assert/is-integer.js";import i from"./../string/lowercase.js";import a from"./../assert/is-leap-year.js";import n from"./../constants/time/seconds-in-day.js";var o=2678400,s=2678400,m=2419200,u=2419200,g=2678400,l=2678400,f=2592e3,p=2592e3,v=2678400,d=2592e3,h=2592e3,j=2678400,c=2678400,w=2678400,b=2678400,y=2592e3,E=2592e3,F=2678400,V=2678400,D=2592e3,M=2592e3,T=2678400,Y=2678400,P={1:2678400,2:2419200,3:2678400,4:2592e3,5:2678400,6:2592e3,7:2678400,8:2678400,9:2592e3,10:2678400,11:2592e3,12:2678400,jan:o,january:s,feb:m,february:u,mar:g,march:l,apr:f,april:p,may:v,jun:d,june:h,jul:j,july:c,aug:w,august:b,sep:y,september:E,oct:F,october:V,nov:D,november:M,dec:T,december:Y},S=e,x=r.isPrimitive,z=t.isPrimitive,A=i,R=a,k=n,q=P;function B(e,r){var t,i,a,n;if(0===arguments.length)i=(n=new Date).getMonth()+1,a=n.getFullYear();else if(1===arguments.length)if(S(e))i=(n=e).getMonth()+1,a=n.getFullYear();else{if(!x(e)&&!z(e))throw new TypeError("invalid argument. First argument must be either a string, integer, or `Date` object. Value: `"+e+"`.");a=(new Date).getFullYear(),i=e}else{if(!x(e)&&!z(e))throw new TypeError("invalid argument. First argument must be either a string or integer. Value: `"+e+"`.");if(!z(r))throw new TypeError("invalid argument. Second argument must be an integer. Value: `"+r+"`.");i=e,a=r}if(z(i)&&(i<1||i>12))throw new RangeError("invalid argument. An integer month value must be on the interval `[1,12]`. Value: `"+i+"`.");if(i=A(i.toString()),void 0===(t=q[i]))throw new Error("invalid argument. Must provide a recognized month. Value: `"+i+"`.");return 2419200===t&&R(a)&&(t+=k),t}var C=B;export default C; //# sourceMappingURL=seconds-in-month.js.map