import{clampNumber as t}from"../utils.js";const e=1e3,n=6e4,r=36e5,i=864e5;function u(t){return new Date(t.getTime())}function o(t){return t instanceof Date&&!isNaN(t.getTime())}function f(e,n,r){return new Date(t(e.getTime(),n?.getTime(),r?.getTime()))}function c(t,e){return new Date(t,e+1,0).getDate()}function a(t,e){return T(new Date,t,e)}const s={Y:function(t,e){const n=u(t),r=t.getUTCFullYear()+e;let i=t.getUTCDate();return i>28&&(i=Math.min(i,c(r,t.getUTCMonth())),n.setUTCDate(i)),n.setUTCFullYear(r),n},M:function(t,e){const n=u(t),r=Math.floor(e/12),i=e-12*r,o=t.getUTCFullYear()+r,f=t.getUTCMonth()+i;let a=t.getUTCDate();return a>28&&(a=Math.min(a,c(o,f)),n.setUTCDate(a)),n.setUTCFullYear(o),n.setUTCMonth(f),n},D:function(t,e){return s._shift(t,e*i)},H:function(t,e){return s._shift(t,e*r)},m:function(t,e){return s._shift(t,6e4*e)},s:function(t,e){return s._shift(t,1e3*e)},S:function(t,e){return s._shift(t,e)},_shift:function(t,e){return new Date(t.getTime()+e)}};function T(t,e,n){const r=s[e];if(null==r)throw new Error(`Cannot shift field "${e}".`);return r(t,n)}const d=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}(Z|[+-]\d{2}:\d{2})$/;function h(t){return g(t,d,(()=>new Date(t)))}const l=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;function D(t,e){return g(t,l,(()=>new Date(`${t}${"UTC"===e?"Z":""}`)))}function g(t,e,n){if(t.match(e)){const t=n();if(o(t))return t}throw new Error(`Invalid date "${t}"`)}export{i as DAY,r as HOUR,n as MINUTE,e as SECOND,f as clampDate,u as cloneDate,c as getNumberOfDaysInMonth,a as getRelativeDateFromNow,o as isDateValid,h as parseIsoDateString,D as parseSimpleDateString,T as shiftDateField};
//# sourceMappingURL=date-utils.js.map
