/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","./has"],(function(e,t){"use strict";const s={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:26784e5,years:31536e6,decades:31536e7,centuries:31536e8},n={milliseconds:{getter:"getMilliseconds",setter:"setMilliseconds",multiplier:1},seconds:{getter:"getSeconds",setter:"setSeconds",multiplier:1},minutes:{getter:"getMinutes",setter:"setMinutes",multiplier:1},hours:{getter:"getHours",setter:"setHours",multiplier:1},days:{getter:"getDate",setter:"setDate",multiplier:1},weeks:{getter:"getDate",setter:"setDate",multiplier:7},months:{getter:"getMonth",setter:"setMonth",multiplier:1},years:{getter:"getFullYear",setter:"setFullYear",multiplier:1},decades:{getter:"getFullYear",setter:"setFullYear",multiplier:10},centuries:{getter:"getFullYear",setter:"setFullYear",multiplier:100}};function r(e,t){const s=new Date(e,t+1,1);return s.setDate(0),s.getDate()}function l(e,t,s){const l=new Date(e.getTime());if(t&&s){const e=n[s],{getter:i,setter:u,multiplier:a}=e;if("months"===s){const e=r(l.getFullYear(),l.getMonth()+t);l.getDate()>e&&l.setDate(e)}l[u](l[i]()+t*a)}return l}function i(e,t,s="milliseconds"){const n=e.getTime(),r=m(t,s,"milliseconds");return new Date(n+r)}function u(e,t){switch(t){case"milliseconds":return new Date(e.getTime());case"seconds":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds());case"minutes":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes());case"hours":return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours());case"days":return new Date(e.getFullYear(),e.getMonth(),e.getDate());case"weeks":return new Date(e.getFullYear(),e.getMonth(),e.getDate()-e.getDay());case"months":return new Date(e.getFullYear(),e.getMonth(),1);case"years":return new Date(e.getFullYear(),0,1);case"decades":return new Date(e.getFullYear()-e.getFullYear()%10,0,1);case"centuries":return new Date(e.getFullYear()-e.getFullYear()%100,0,1);default:return new Date}}function a(e,t,s="milliseconds"){const n=new Date(m(t,s,"milliseconds"));return n.setUTCFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n}function o(e,t="milliseconds"){const s=m(e.getUTCHours(),"hours","milliseconds"),n=m(e.getUTCMinutes(),"minutes","milliseconds"),r=m(e.getUTCSeconds(),"seconds","milliseconds");return m(s+n+r+e.getUTCMilliseconds(),"milliseconds",t)}function g(e,t){const s=new Date(e.getTime());return s.setUTCFullYear(t.getFullYear(),t.getMonth(),t.getDate()),s}function c(e){const t=new Date(0);return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),t}function m(e,t,n){if(0===e)return 0;return e*s[t]/s[n]}e.convertTime=m,e.makeUTCTime=a,e.offsetDate=l,e.offsetDateUTC=i,e.resetUTCDate=g,e.timeSinceUTCMidnight=o,e.truncateDate=u,e.truncateLocalTime=c,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
