date-object
Version:
JavaScript library for working with Date and Time in different calendars and locals
2 lines (1 loc) • 20.4 kB
JavaScript
function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function e(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y(r.key),r)}}function i(t,e,n){return(e=y(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){return u(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,a,s,u=[],o=!0,h=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;o=!1}else for(;!(o=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);o=!0);}catch(t){h=!0,i=t}finally{try{if(!o&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(h)throw i}}return u}}(t,e)||h(t,e)||l()}function s(t){return function(t){if(Array.isArray(t))return c(t)}(t)||o(t)||h(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t){if(Array.isArray(t))return t}function o(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function h(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=h(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function y(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function d(t,e){return function(t,e){if(e.get)return e.get.call(t);return e.value}(t,v(t,e,"get"))}function m(t,e,n){return function(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}(t,v(t,e,"set"),n),n}function v(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function g(t,e,n){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,n)}function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var k={name:"gregorian_en",months:[["January","Jan"],["February","Feb"],["March","Mar"],["April","Apr"],["May","May"],["June","Jun"],["July","Jul"],["August","Aug"],["September","Sep"],["October","Oct"],["November","Nov"],["December","Dec"]],weekDays:[["Saturday","Sat"],["Sunday","Sun"],["Monday","Mon"],["Tuesday","Tue"],["Wednesday","Wed"],["Thursday","Thu"],["Friday","Fri"]],digits:["0","1","2","3","4","5","6","7","8","9"],meridiems:[["AM","am"],["PM","pm"]]},b={name:"gregorian",startYear:1,yearLength:365,epoch:1721424,century:20,weekStartDayIndex:1,getMonthLengths:function(t){return[31,t?29:28,31,30,31,30,31,31,30,31,30,31]},isLeap:function(t){return t%4==0&&t%100!=0||t%400==0},getLeaps:function(t){if(0!==t){for(var e=t>0?1:-1,n=[];t>0?e<=t:t<=e;)this.isLeap(e)&&n.push(e),t>0?e++:e--;return n}},getDayOfYear:function(t){for(var e=t.year,n=t.month,r=t.day,i=this.getMonthLengths(this.isLeap(e)),a=0;a<n.index;a++)r+=i[a];return r},getAllDays:function(t){var e=t.year;return this.yearLength*(e-1)+this.leapsLength(e)+this.getDayOfYear(t)},leapsLength:function(t){return((t-1)/4|0)+(-(t-1)/100|0)+((t-1)/400|0)},guessYear:function(t,e){return~~(t/365.24)+(e>0?1:-1)}};function w(t){return t&&t.constructor===Object}function D(t){if(!isNaN(t))return parseInt(t)}function M(t){return Array.isArray(t)}function O(t,e,n){return void 0===t||t<e||t>n}var S=new WeakMap,Y=new WeakMap,L=new WeakMap,W=new WeakMap,x=new WeakMap,j=new WeakMap,N=new WeakMap,A=new WeakMap,I=new WeakMap,T=new WeakMap,F=new WeakMap,P=new WeakMap,E=new WeakMap,H=new WeakMap,V=new WeakMap,J=new WeakMap,C=new WeakMap,_=new WeakMap,U=new WeakMap,R=function(){function t(n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),g(this,S,{writable:!0,value:void 0}),g(this,Y,{writable:!0,value:void 0}),g(this,L,{writable:!0,value:void 0}),g(this,W,{writable:!0,value:void 0}),g(this,x,{writable:!0,value:void 0}),g(this,j,{writable:!0,value:void 0}),g(this,N,{writable:!0,value:void 0}),g(this,A,{writable:!0,value:void 0}),g(this,I,{writable:!0,value:k}),g(this,T,{writable:!0,value:b}),g(this,F,{writable:!0,value:!1}),g(this,P,{writable:!0,value:{}}),g(this,E,{writable:!0,value:/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\dZ$/}),g(this,H,{writable:!0,value:[]}),g(this,V,{writable:!0,value:!0}),g(this,J,{writable:!0,value:function(t,e){switch(t){case"YYYY":return["year",e];case"YY":return["year","".concat(d(r,T).century).concat(e)];case"MMMM":case"MMM":return["month",r.months.findIndex((function(t){var n=t.name,r=t.shortName;return new RegExp(e,"i").test(n+r)}))+1];case"MM":case"M":return["month",e];case"DD":case"D":return["day",e];case"HH":case"H":return["hour",e];case"hh":case"h":var n=D(e);return["hour",n>12?n-12:n];case"mm":case"m":return["minute",e];case"ss":case"s":return["second",e];case"SSS":case"SS":case"S":return["millisecond",e];default:return[]}}}),g(this,C,{writable:!0,value:function(){return 0===d(r,S)&&0!==d(r,T).startYear}}),g(this,_,{writable:!0,value:function(){if(d(r,V)&&r.isValid){var t=Math.floor,e=function(e,n){return[(a=e,(a<0?-1:1)*Math.abs(t(e/n))),(r=e,i=n,(r<0&&-0!==t(r%i)?i:0)+t(e%n))];var r,i,a},n=function(){if(d(r,Y)<0||d(r,Y)>11){var t=d(r,Y)<0?-1:1,n=a(e(d(r,Y),12),2),i=n[0],s=n[1];m(r,S,d(r,S)+i),m(r,Y,s),d(r,C).call(r)&&m(r,S,t)}};for(m(r,V,!1),[["millisecond","second",1e3],["second","minute",60],["minute","hour",60],["hour","day",24]].forEach((function(t){var n=a(t,3),i=n[0],s=n[1],u=n[2];if(function(t,e){return t>=e||t<0}(r[i],u)){var o=a(e(r[i],u),2),h=o[0],c=o[1];r[s]+=h,r[i]=c}})),m(r,V,!0),n();d(r,L)<-d(r,T).yearLength||d(r,L)>d(r,T).yearLength;){if(d(r,Y)>0){for(var i=d(r,T).getMonthLengths(r.isLeap),s=0;s<d(r,Y);s++)m(r,L,d(r,L)+i[s]);m(r,Y,0)}var u=r.isLeap?r.calendar.yearLength+1:r.calendar.yearLength;m(r,L,d(r,L)+u*(d(r,L)<0?1:-1)),m(r,S,d(r,S)+(d(r,L)<0?-1:1))}for(;;){var o;for(n();d(r,L)<1;)m(r,Y,d(r,Y)-1),n(),m(r,L,r.month.length+d(r,L));if(d(r,L)<=r.month.length||isNaN(d(r,L)))break;m(r,L,d(r,L)-r.month.length),m(r,Y,(o=d(r,Y),++o))}d(r,W)||m(r,W,0),d(r,x)||m(r,x,0),d(r,j)||m(r,j,0),d(r,N)||m(r,N,0)}}}),g(this,U,{writable:!0,value:function(){return(d(r,P).weekDays||d(r,I).weekDays).map((function(t,e){var n=a(t,2),i=n[0],s=n[1],u=e-r.weekStartDayIndex;return u<0&&(u+=7),{name:i,shortName:s,index:u,number:u+1,toString:function(){return this.number.toString()},valueOf:function(){return this.number}}}))}});var i=w(n)?e({},n):n,s=!0;if(i&&"boolean"!=typeof i||(i={date:new Date}),w(i)||(i={date:i}),0!==Object.keys(i).length){for(var u in w(i.calendar)&&m(this,T,i.calendar),w(i.locale)&&m(this,I,i.locale),isNaN(i.year)&&isNaN(i.month)&&isNaN(i.day)&&!i.date&&(i.date=new Date),i.date&&("string"==typeof i.date&&i.format&&m(this,A,i.format),this.setDate(i.date),i.calendar&&this.convert(i.calendar),s=!1),delete i.calendar,delete i.locale,delete i.date,i)this.set(u,i[u]);d(this,C).call(this)&&m(this,S,-1),s&&d(this,_).call(this)}}var i,c,y;return i=t,c=[{key:"parse",value:function(t){if(!t)return this;var e,n,r=d(this,A),i=d(this,I).digits,c=f(i);try{for(c.s();!(e=c.n()).done;){var y=e.value;t=t.replace(new RegExp(y,"g"),i.indexOf(y))}}catch(t){c.e(t)}finally{c.f()}if(r)for(var v=r.split(/[^\w\u0600-\u06FF]/),g=t.split(/[^\w\u0600-\u06FF]/),p=0;p<v.length;p++)this.set.apply(this,s(d(this,J).call(this,v[p],g[p])));else{var k=t.match(/(-?\d{2,4})?\W?([A-z]{3,9}|\d{1,2})?\W?(\d{1,2})?\W?(\d{1,2})?\W?(\d{1,2})?\W?(\d{1,2})?\W?(\d{1,3})?\W?(am|pm)?/),b=(u(n=k)||o(n)||h(n)||l()).slice(1),w=b[1];w&&(w=/\d+/.test(w)?D(w)-1:this.months.findIndex((function(t){return new RegExp(w,"i").test(t.name)}))),b[1]=w;var M=a(b.map(D),7),O=M[0],T=M[1],F=M[2],P=M[3],E=M[4],H=M[5],V=M[6];m(this,S,O),m(this,Y,T),m(this,L,F),m(this,W,P),m(this,x,E),m(this,j,H),m(this,N,V)}var C=a(d(this,I).meridiems[1],2),U=C[0],R=C[1];return d(this,W)<12&&(t.includes(U)||t.includes(R))&&m(this,W,d(this,W)+12),d(this,_).call(this),this}},{key:"convert",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,n=arguments.length>1?arguments[1]:void 0;if(w(n)&&m(this,I,n),!w(e)||e.name===d(this,T).name)return this;var r=this.toJulianDay()-e.epoch,i=new t({calendar:e,year:e.guessYear(r,d(this,S)),month:1,day:1});return i.day+=r-i.toDays(),m(this,S,i.year),m(this,Y,i.month.index),m(this,L,i.day),m(this,T,e),this}},{key:"format",value:function(t,e){if(!this.isValid||t&&"string"!=typeof t)return"";t||(t=d(this,A)||"YYYY/MM/DD"),M(e)||(e=[]),e=(e=e.concat(d(this,H))).filter((function(t){return"string"==typeof t||(console.warn("type of all items in the ignore list must be string, found",n(t)),!1)})).map((function(t){return t.replace(/[*/+\-()[\]{}\s$^]/g,(function(t){return"\\"+t}))}));var r,i=new RegExp("".concat(e.join("|")).concat(e.length>0?"|":"","YYYY|YY|MMMM|MMM|MM|M|WW|W|DDDD|DDD|DD|D|dddd|ddd|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|SS|S|A|a|."),"g"),a="",s=f(t.match(i)||[]);try{for(s.s();!(r=s.n()).done;){var u=r.value,o=this.getValue(u);a+=e.includes(u)?u:0===o?o:o||u}}catch(t){s.e(t)}finally{s.f()}var h=this.digits;return a.replace(/[0-9]/g,(function(t){return h[t]}))}},{key:"getProperty",value:function(t){return this.getValue(t)}},{key:"getValue",value:function(t){var e=function(t){return t<10?"0"+t:t};switch(t){case"YYYY":return this.year;case"YY":return this.year.toString().substring(2,4);case"MMMM":return this.month.name;case"MMM":return this.month.shortName;case"MM":return e(this.month.number);case"M":return this.month.number;case"WW":return e(this.weekOfYear);case"W":return this.weekOfYear;case"DDDD":case"DDD":return this.dayOfYear;case"DD":return e(this.day);case"D":return this.day;case"HH":return e(this.hour);case"H":return this.hour;case"dddd":return this.weekDay.name;case"ddd":return this.weekDay.shortName;case"dd":return e(this.weekDay.number);case"d":return this.weekDay.number;case"hh":return e(this.hour>12?this.hour-12:this.hour||12);case"h":return this.hour>12?this.hour-12:this.hour||12;case"mm":return e(this.minute);case"m":return this.minute;case"ss":return e(this.second);case"s":return this.second;case"SSS":return d(this,N)<10?"00".concat(d(this,N)):d(this,N)<100?"0".concat(d(this,N)):d(this,N);case"SS":return d(this,N)<10?"00":d(this,N)<100?("0"+d(this,N)).substring(2,0):d(this,N).toString().substring(0,2);case"S":return d(this,N)<10||d(this,N)<100?"0":d(this,N).toString().substring(0,1);case"a":return this.hour>=12?d(this,I).meridiems[1][1]:d(this,I).meridiems[0][1];case"A":return this.hour>=12?d(this,I).meridiems[1][0]:d(this,I).meridiems[0][0];default:return""}}},{key:"setYear",value:function(t){return this.year=t,this}},{key:"setMonths",value:function(t){return this.months=t,this}},{key:"setMonth",value:function(t){return this.month=t,this}},{key:"setWeekDays",value:function(t){return this.weekDays=t,this}},{key:"setDigits",value:function(t){return this.digits=t,this}},{key:"setDay",value:function(t){return this.day=t,this}},{key:"setHour",value:function(t){return this.hour=t,this}},{key:"setMinute",value:function(t){return this.minute=t,this}},{key:"setSecond",value:function(t){return this.second=t,this}},{key:"setMillisecond",value:function(t){return this.millisecond=t,this}},{key:"setFormat",value:function(t){return m(this,A,t),this}},{key:"setLocale",value:function(t){return this.locale=t,this}},{key:"setCalendar",value:function(t){return this.calendar=t,this}},{key:"setDate",value:function(e){if("string"==typeof e){if(!d(this,E).test(e))return this.parse(e);e=new Date(e)}return"number"==typeof e&&(e=new Date(e)),e instanceof Date&&(m(this,T,b),m(this,S,e.getFullYear()),m(this,Y,e.getMonth()),m(this,L,e.getDate()),m(this,W,e.getHours()),m(this,x,e.getMinutes()),m(this,j,e.getSeconds()),m(this,N,e.getMilliseconds()),m(this,F,!1)),e instanceof t&&(m(this,S,e.year),m(this,Y,e.month.index),m(this,L,e.day),m(this,W,e.hour),m(this,x,e.minute),m(this,j,e.second),m(this,N,e.millisecond),m(this,I,e.locale),m(this,A,e._format),m(this,T,e.calendar),m(this,F,e.isUTC),m(this,H,e.ignoreList),m(this,P,e.custom)),this}},{key:"setIgnoreList",value:function(t){return this.ignoreList=t,this}},{key:"set",value:function(t,n){if(null==t)return this;if(w(t)){var r=e({},t);for(var i in r.date&&(this.setDate(r.date),delete r.date),r.calendar&&(this.convert(r.calendar),delete r.calendar),r.locale&&(this.setLocale(r.locale),delete r.locale),m(this,V,!1),r)this.set(i,r[i]);return m(this,V,!0),d(this,_).call(this),this}"format"===t&&(t="_format");try{this[t]=n}catch(t){}return this}},{key:"add",value:function(t,e){if(!(t=D(t))||!e)return this;switch(e){case"years":case"y":e="year";break;case"months":case"M":e="month";break;case"days":case"d":e="day";break;case"hours":case"h":e="hour";break;case"minutes":case"m":e="minute";break;case"seconds":case"s":e="second";break;case"milliseconds":case"ms":e="millisecond"}return this[e]+=t,this}},{key:"subtract",value:function(t,e){return this.add(-t,e)}},{key:"toFirstOfYear",value:function(){return this.month=1,this.day=1,this}},{key:"toLastOfYear",value:function(){return this.day>=29&&(this.day=29),this.month=12,this.toLastOfMonth(),this}},{key:"toFirstOfMonth",value:function(){return m(this,L,1),this}},{key:"toLastOfMonth",value:function(){return m(this,L,0),m(this,Y,d(this,Y)+1),d(this,_).call(this),this}},{key:"toFirstOfWeek",value:function(){return this.day-=this.weekDay.index,this}},{key:"toLastOfWeek",value:function(){return this.day+=6-this.weekDay.index,this}},{key:"toFirstWeekOfYear",value:function(){return this.toFirstOfYear(),0===this.weekDay.index?this:this.toLastOfWeek().setDay(this.day+1)}},{key:"toLastWeekOfYear",value:function(){return this.toLastOfYear().toFirstOfWeek()}},{key:"toString",value:function(){return this.format()}},{key:"toDate",value:function(){var e=new t(this);return"gregorian"!==d(this,T).name&&e.convert(b),new Date(e.year,e.month.index,e.day,e.hour,e.minute,e.second,e.millisecond)}},{key:"toUTC",value:function(){return d(this,F)||(this.minute+=this.toDate().getTimezoneOffset(),m(this,F,!0)),this}},{key:"toUnix",value:function(){return this.unix}},{key:"toJulianDay",value:function(){return this.toDays()+d(this,T).epoch}},{key:"toObject",value:function(){return{year:d(this,S),month:this.month,day:d(this,L),weekDay:this.weekDay,hour:d(this,W),minute:d(this,x),second:d(this,j),millisecond:d(this,N),weekOfYear:this.weekOfYear,dayOfYear:this.dayOfYear,daysLeft:this.daysLeft,calendar:d(this,T),locale:d(this,I),format:d(this,A)||"YYYY/MM/DD",ignoreList:d(this,H)}}},{key:"toJSON",value:function(){return this.valueOf()}},{key:"valueOf",value:function(){return this.toDate().valueOf()}},{key:"toDays",value:function(){if(this.isValid)return d(this,T).getAllDays(this)}},{key:"dayOfBeginning",get:function(){return this.toDays()}},{key:"dayOfYear",get:function(){if(this.isValid)return d(this,T).getDayOfYear(this)}},{key:"weekOfYear",get:function(){if(this.isValid)return 1+~~(this.dayOfYear/7)}},{key:"daysLeft",get:function(){if(this.isValid){var t=d(this,T).yearLength;return(this.isLeap?t+1:t)-this.dayOfYear}}},{key:"year",get:function(){return d(this,S)},set:function(t){m(this,S,D(t)),d(this,_).call(this)}},{key:"month",get:function(){return this.months[d(this,Y)]||{}},set:function(t){var e;t=null!==(e=D(t.valueOf())-1)&&void 0!==e?e:void 0,m(this,Y,t),O(t,0,11)&&d(this,_).call(this)}},{key:"monthIndex",get:function(){return d(this,Y)}},{key:"day",get:function(){return d(this,L)},set:function(t){t=D(t),m(this,L,t),O(t,1,28)&&d(this,_).call(this)}},{key:"weekDay",get:function(){if(!this.isValid)return{};var t=(this.toJulianDay()+3)%7;return d(this,U).call(this)[t]}},{key:"hour",get:function(){return d(this,W)},set:function(t){t=D(t),m(this,W,t),O(t,0,23)&&d(this,_).call(this)}},{key:"minute",get:function(){return d(this,x)},set:function(t){t=D(t),m(this,x,t),O(t,0,59)&&d(this,_).call(this)}},{key:"second",get:function(){return d(this,j)},set:function(t){t=D(t),m(this,j,t),O(t,0,59)&&d(this,_).call(this)}},{key:"millisecond",get:function(){return d(this,N)},set:function(t){t=D(t),m(this,N,t),O(t,0,999)&&d(this,_).call(this)}},{key:"months",get:function(){var t=d(this,T).getMonthLengths(this.isLeap),e=(d(this,P).months||d(this,I).months).map((function(e,n){var r=a(e,2);return{name:r[0],shortName:r[1],length:t[n],index:n,number:n+1,toString:function(){return this.number.toString()},valueOf:function(){return this.number}}}));return e},set:function(t){if(!t)return delete d(this,P).months;M(t)&&12===t.length&&t.every((function(t){return M(t)&&2===t.length&&t.every((function(t){return"string"==typeof t}))}))&&(d(this,P).months=t)}},{key:"weekDays",get:function(){return d(this,U).call(this).sort((function(t,e){return t.index-e.index}))},set:function(t){if(!t)return delete d(this,P).weekDays;M(t)&&7===t.length&&t.every((function(t){return M(t)&&2===t.length&&t.every((function(t){return"string"==typeof t}))}))&&(d(this,P).weekDays=t)}},{key:"leaps",get:function(){return d(this,T).getLeaps(d(this,S))}},{key:"calendar",get:function(){return d(this,T)},set:function(t){this.convert(t)}},{key:"locale",get:function(){return d(this,I)},set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k;w(t)&&m(this,I,t)}},{key:"custom",get:function(){return d(this,P)}},{key:"meridiems",get:function(){return d(this,I).meridiems}},{key:"digits",get:function(){return d(this,P).digits||d(this,I).digits},set:function(t){if(!t)return delete d(this,P).digits;M(t)&&10===t.length&&(d(this,P).digits=t)}},{key:"_format",get:function(){return d(this,A)},set:function(t){"string"==typeof t&&m(this,A,t)}},{key:"isLeap",get:function(){return d(this,T).isLeap(d(this,S))}},{key:"isValid",get:function(){return!isNaN(d(this,S))&&!isNaN(d(this,Y))&&!isNaN(d(this,L))}},{key:"isUTC",get:function(){return d(this,F)}},{key:"unix",get:function(){return(this.valueOf()-this.millisecond)/1e3}},{key:"ignoreList",get:function(){return d(this,H)},set:function(t){M(t)&&m(this,H,t)}},{key:"weekStartDayIndex",get:function(){return d(this,T).weekStartDayIndex},set:function(t){void 0!==(t=D(t))&&(d(this,T).weekStartDayIndex=Math.abs(t)%7)}},{key:"date",set:function(t){this.setDate(t)}}],c&&r(i.prototype,c),y&&r(i,y),Object.defineProperty(i,"prototype",{writable:!1}),t}(),z=p(R);export{z as default};