@tabworthy/components 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,9 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import moment from "moment";
2
+ import dayjs from "dayjs";
3
+ import customParseFormat from "dayjs/plugin/customParseFormat";
4
+ import localizedFormat from "dayjs/plugin/localizedFormat";
5
+ dayjs.extend(customParseFormat);
6
+ dayjs.extend(localizedFormat);
3
7
  import { getISODateString, removeTimezoneOffset } from "../../../../shared/utils/utils";
4
8
  const defaultLabels = {
5
9
  selected: "selected",
@@ -125,10 +129,10 @@ export class InclusiveTimes {
125
129
  this.handleInputChange = (event) => {
126
130
  const value = event.target.value;
127
131
  // Try to parse the input value as a datetime
128
- const parsed = moment(value);
132
+ const parsed = dayjs(value);
129
133
  if (parsed.isValid()) {
130
- this.selectedHours = parsed.hours();
131
- this.selectedMinutes = parsed.minutes();
134
+ this.selectedHours = parsed.hour();
135
+ this.selectedMinutes = parsed.minute();
132
136
  this.updateValue(parsed.toDate());
133
137
  }
134
138
  };
@@ -161,12 +165,12 @@ export class InclusiveTimes {
161
165
  // Parse the first datetime value to set time picker
162
166
  const firstValue = Array.isArray(this.value) ? this.value[0] : this.value;
163
167
  if (firstValue) {
164
- const parsed = moment(firstValue, this.format);
168
+ const parsed = dayjs(firstValue, this.format);
165
169
  if (parsed.isValid()) {
166
170
  this.selectedDate = parsed.toDate();
167
- this.selectedHours = parsed.hours();
168
- this.selectedMinutes = parsed.minutes();
169
- this.selectedSeconds = parsed.seconds();
171
+ this.selectedHours = parsed.hour();
172
+ this.selectedMinutes = parsed.minute();
173
+ this.selectedSeconds = parsed.second();
170
174
  }
171
175
  }
172
176
  }
@@ -178,10 +182,10 @@ export class InclusiveTimes {
178
182
  if (Array.isArray(date)) {
179
183
  // Range mode
180
184
  const formattedDates = date.map((d) => {
181
- const m = moment(d);
182
- m.hours(this.selectedHours);
183
- m.minutes(this.selectedMinutes);
184
- m.seconds(this.selectedSeconds);
185
+ const m = dayjs(d)
186
+ .hour(this.selectedHours)
187
+ .minute(this.selectedMinutes)
188
+ .second(this.selectedSeconds);
185
189
  return m.format(this.format);
186
190
  });
187
191
  this.internalValue = formattedDates;
@@ -190,10 +194,10 @@ export class InclusiveTimes {
190
194
  }
191
195
  else {
192
196
  // Single date mode
193
- const m = moment(date);
194
- m.hours(this.selectedHours);
195
- m.minutes(this.selectedMinutes);
196
- m.seconds(this.selectedSeconds);
197
+ const m = dayjs(date)
198
+ .hour(this.selectedHours)
199
+ .minute(this.selectedMinutes)
200
+ .second(this.selectedSeconds);
197
201
  const formatted = m.format(this.format);
198
202
  this.internalValue = formatted;
199
203
  this.value = formatted;
@@ -211,13 +215,13 @@ export class InclusiveTimes {
211
215
  if (Array.isArray(this.internalValue)) {
212
216
  // Format range
213
217
  const formatted = this.internalValue
214
- .map((v) => moment(v, this.format).format("lll"))
218
+ .map((v) => dayjs(v, this.format).format("lll"))
215
219
  .join(` ${this.timesLabels.to} `);
216
220
  this.inputRef.value = formatted;
217
221
  }
218
222
  else {
219
223
  // Format single datetime
220
- this.inputRef.value = moment(this.internalValue, this.format).format("lll");
224
+ this.inputRef.value = dayjs(this.internalValue, this.format).format("lll");
221
225
  }
222
226
  }
223
227
  getClassName(suffix) {
@@ -227,8 +231,8 @@ export class InclusiveTimes {
227
231
  if (!dateString)
228
232
  return null;
229
233
  const date = Array.isArray(dateString)
230
- ? dateString.map((d) => moment(d, this.format).toDate())
231
- : moment(dateString, this.format).toDate();
234
+ ? dateString.map((d) => dayjs(d, this.format).toDate())
235
+ : dayjs(dateString, this.format).toDate();
232
236
  return date;
233
237
  }
234
238
  async clearValue() {
@@ -245,10 +249,10 @@ export class InclusiveTimes {
245
249
  }
246
250
  render() {
247
251
  var _a;
248
- return (h(Host, { key: 'de07eab0ee0cd6624756ce18a0dcc38a509692e4', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '666a1cd43b7c2d1633210d7422ec8d2c3fc44e44', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '222432b8a431bac954fb625f5b724df077d9feeb', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: 'c3284e4348cd736f2edf708978956fb88f78118a', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
252
+ return (h(Host, { key: '03aaff051aa6af4a7606b64056336c4f597ffaeb', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: 'd05264d3b32741ccfeca0be4473f9323b4934071', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '7a4306a4863ffffe35a0d33c80ebfc19298c2182', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '03080dc8619d396347b831b307c8fa9070434b35', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
249
253
  [this.getClassName("input")]: true,
250
254
  [this.inputClass]: !!this.inputClass
251
- }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '9087c6b9cec31990b13ba6a1a7ad66f937ddee3a', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '79613c7af13afe36e03cfede116b260f9d1d2b63', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
255
+ }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: 'cc384691007bc6eb4044098ab79ba38809375de7', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '14290fe8ca21e0027c384bd56d913d2cdda55380', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
252
256
  if (this.pickerRef) {
253
257
  this.pickerRef.modalIsOpen = true;
254
258
  }
@@ -256,7 +260,7 @@ export class InclusiveTimes {
256
260
  if (this.pickerRef) {
257
261
  this.pickerRef.modalIsOpen = false;
258
262
  }
259
- }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '716440a779e1e614fbef292c7c1cc801cde57ee6', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '02579a80370918076f36e04f64b6626893acf1cd', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, h("div", { key: 'df629acf66bc6a83c7c0601f6cff39a8a27ddba2', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '084ba933dbe96086d9c8f21494e4016eb6d3ac66', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '788081745c21b0702fcc0f8d79f0c6fe88b4372d', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels }))))), this.errorState && (h("div", { key: '0742a70dcb66f4523131c29d60f2056c9cf94320', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
263
+ }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '83c1e85f688a0ff213872e54a96702429f00869b', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '6afcc9ddb6fcedf07127c933ad1ed192a4c88eaf', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, h("div", { key: '7e47f4b63a85d6431f8019a8725acbf79fb44d67', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '8b72711de0422f1b1848bb22a72ed363b1c63ebb', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '29f47e57c4f3f94232345bbe602d0278b5f53fa4', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels }))))), this.errorState && (h("div", { key: 'aa6f743bc35538f6271a45bb2564e89164e5a909', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
260
264
  }
261
265
  static get is() { return "tabworthy-times"; }
262
266
  static get encapsulation() { return "scoped"; }
@@ -0,0 +1 @@
1
+ function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,n,e={exports:{}},i=t((r||(r=1,e.exports=function(){var t=6e4,r=36e5,n="millisecond",e="second",i="minute",u="hour",s="day",a="week",c="month",h="quarter",o="year",f="date",d="Invalid Date",M=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var r=["th","st","nd","rd"],n=t%100;return"["+t+(r[(n-20)%10]||r[n]||r[0])+"]"}},m=function(t,r,n){var e=String(t);return!e||e.length>=r?t:""+Array(r+1-e.length).join(n)+t},Y={s:m,z:function(t){var r=-t.utcOffset(),n=Math.abs(r),e=Math.floor(n/60),i=n%60;return(r<=0?"+":"-")+m(e,2,"0")+":"+m(i,2,"0")},m:function t(r,n){if(r.date()<n.date())return-t(n,r);var e=12*(n.year()-r.year())+(n.month()-r.month()),i=r.clone().add(e,c),u=n-i<0,s=r.clone().add(e+(u?-1:1),c);return+(-(e+(n-i)/(u?i-s:s-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:o,w:a,d:s,D:f,h:u,m:i,s:e,ms:n,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},w="en",l={};l[w]=D;var y="$isDayjsObject",S=function(t){return t instanceof k||!(!t||!t[y])},g=function t(r,n,e){var i;if(!r)return w;if("string"==typeof r){var u=r.toLowerCase();l[u]&&(i=u),n&&(l[u]=n,i=u);var s=r.split("-");if(!i&&s.length>1)return t(s[0])}else{var a=r.name;l[a]=r,i=a}return!e&&i&&(w=i),i||!e&&w},_=function(t,r){if(S(t))return t.clone();var n="object"==typeof r?r:{};return n.date=t,n.args=arguments,new k(n)},b=Y;b.l=g,b.i=S,b.w=function(t,r){return _(t,{locale:r.$L,utc:r.$u,x:r.$x,$offset:r.$offset})};var k=function(){function D(t){this.$L=g(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[y]=!0}var m=D.prototype;return m.parse=function(t){this.$d=function(t){var r=t.date,n=t.utc;if(null===r)return new Date(NaN);if(b.u(r))return new Date;if(r instanceof Date)return new Date(r);if("string"==typeof r&&!/Z$/i.test(r)){var e=r.match(M);if(e){var i=e[2]-1||0,u=(e[7]||"0").substring(0,3);return n?new Date(Date.UTC(e[1],i,e[3]||1,e[4]||0,e[5]||0,e[6]||0,u)):new Date(e[1],i,e[3]||1,e[4]||0,e[5]||0,e[6]||0,u)}}return new Date(r)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===d)},m.isSame=function(t,r){var n=_(t);return this.startOf(r)<=n&&n<=this.endOf(r)},m.isAfter=function(t,r){return _(t)<this.startOf(r)},m.isBefore=function(t,r){return this.endOf(r)<_(t)},m.$g=function(t,r,n){return b.u(t)?this[r]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,r){var n=this,h=!!b.u(r)||r,d=b.p(t),M=function(t,r){var e=b.w(n.$u?Date.UTC(n.$y,r,t):new Date(n.$y,r,t),n);return h?e:e.endOf(s)},v=function(t,r){return b.w(n.toDate()[t].apply(n.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(r)),n)},D=this.$W,m=this.$M,Y=this.$D,w="set"+(this.$u?"UTC":"");switch(d){case o:return h?M(1,0):M(31,11);case c:return h?M(1,m):M(0,m+1);case a:var l=this.$locale().weekStart||0,y=(D<l?D+7:D)-l;return M(h?Y-y:Y+(6-y),m);case s:case f:return v(w+"Hours",0);case u:return v(w+"Minutes",1);case i:return v(w+"Seconds",2);case e:return v(w+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,r){var a,h=b.p(t),d="set"+(this.$u?"UTC":""),M=(a={},a[s]=d+"Date",a[f]=d+"Date",a[c]=d+"Month",a[o]=d+"FullYear",a[u]=d+"Hours",a[i]=d+"Minutes",a[e]=d+"Seconds",a[n]=d+"Milliseconds",a)[h],v=h===s?this.$D+(r-this.$W):r;if(h===c||h===o){var D=this.clone().set(f,1);D.$d[M](v),D.init(),this.$d=D.set(f,Math.min(this.$D,D.daysInMonth())).$d}else M&&this.$d[M](v);return this.init(),this},m.set=function(t,r){return this.clone().$set(t,r)},m.get=function(t){return this[b.p(t)]()},m.add=function(n,h){var f,d=this;n=Number(n);var M=b.p(h),v=function(t){var r=_(d);return b.w(r.date(r.date()+Math.round(t*n)),d)};if(M===c)return this.set(c,this.$M+n);if(M===o)return this.set(o,this.$y+n);if(M===s)return v(1);if(M===a)return v(7);var D=(f={},f[i]=t,f[u]=r,f[e]=1e3,f)[M]||1,m=this.$d.getTime()+n*D;return b.w(m,this)},m.subtract=function(t,r){return this.add(-1*t,r)},m.format=function(t){var r=this,n=this.$locale();if(!this.isValid())return n.invalidDate||d;var e=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),u=this.$H,s=this.$m,a=this.$M,c=n.weekdays,h=n.months,o=function(t,n,i,u){return t&&(t[n]||t(r,e))||i[n].slice(0,u)},f=function(t){return b.s(u%12||12,t,"0")},M=n.meridiem||function(t,r,n){var e=t<12?"AM":"PM";return n?e.toLowerCase():e};return e.replace(v,(function(t,e){return e||function(t){switch(t){case"YY":return String(r.$y).slice(-2);case"YYYY":return b.s(r.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return o(n.monthsShort,a,h,3);case"MMMM":return o(h,a);case"D":return r.$D;case"DD":return b.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return o(n.weekdaysMin,r.$W,c,2);case"ddd":return o(n.weekdaysShort,r.$W,c,3);case"dddd":return c[r.$W];case"H":return String(u);case"HH":return b.s(u,2,"0");case"h":return f(1);case"hh":return f(2);case"a":return M(u,s,!0);case"A":return M(u,s,!1);case"m":return String(s);case"mm":return b.s(s,2,"0");case"s":return String(r.$s);case"ss":return b.s(r.$s,2,"0");case"SSS":return b.s(r.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(n,f,d){var M,v=this,D=b.p(f),m=_(n),Y=(m.utcOffset()-this.utcOffset())*t,w=this-m,l=function(){return b.m(v,m)};switch(D){case o:M=l()/12;break;case c:M=l();break;case h:M=l()/3;break;case a:M=(w-Y)/6048e5;break;case s:M=(w-Y)/864e5;break;case u:M=w/r;break;case i:M=w/t;break;case e:M=w/1e3;break;default:M=w}return d?M:b.a(M)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return l[this.$L]},m.locale=function(t,r){if(!t)return this.$L;var n=this.clone(),e=g(t,r,!0);return e&&(n.$L=e),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},D}(),H=k.prototype;return _.prototype=H,[["$ms",n],["$s",e],["$m",i],["$H",u],["$W",s],["$M",c],["$y",o],["$D",f]].forEach((function(t){H[t[1]]=function(r){return this.$g(r,t[0],t[1])}})),_.extend=function(t,r){return t.$i||(t(r,k,_),t.$i=!0),_},_.locale=g,_.isDayjs=S,_.unix=function(t){return _(1e3*t)},_.en=l[w],_.Ls=l,_.p={},_}()),e.exports)),u={exports:{}},s=t(n?u.exports:(n=1,u.exports=function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,e=/\d\d/,i=/\d\d?/,u=/\d*[^-_:/,()\s\d]+/,s={},a=function(t){return(t=+t)+(t>68?1900:2e3)},c=function(t){return function(r){this[t]=+r}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var r=t.match(/([+-]|\d\d)/g),n=60*r[1]+(+r[2]||0);return 0===n?0:"+"===r[0]?-n:n}(t)}],o=function(t){var r=s[t];return r&&(r.indexOf?r:r.s.concat(r.f))},f=function(t,r){var n,e=s.meridiem;if(e){for(var i=1;i<=24;i+=1)if(t.indexOf(e(i,0,r))>-1){n=i>12;break}}else n=t===(r?"pm":"PM");return n},d={A:[u,function(t){this.afternoon=f(t,!1)}],a:[u,function(t){this.afternoon=f(t,!0)}],Q:[n,function(t){this.month=3*(t-1)+1}],S:[n,function(t){this.milliseconds=100*+t}],SS:[e,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[e,c("day")],Do:[u,function(t){var r=s.ordinal,n=t.match(/\d+/);if(this.day=n[0],r)for(var e=1;e<=31;e+=1)r(e).replace(/\[|\]/g,"")===t&&(this.day=e)}],w:[i,c("week")],ww:[e,c("week")],M:[i,c("month")],MM:[e,c("month")],MMM:[u,function(t){var r=o("months"),n=(o("monthsShort")||r.map((function(t){return t.slice(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[u,function(t){var r=o("months").indexOf(t)+1;if(r<1)throw new Error;this.month=r%12||r}],Y:[/[+-]?\d+/,c("year")],YY:[e,function(t){this.year=a(t)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function M(n){var e;e=s&&s.formats;for(var i=(n=n.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(r,n,i){var u=i&&i.toUpperCase();return n||e[i]||t[i]||e[u].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,r,n){return r||n.slice(1)}))}))).match(r),u=i.length,a=0;a<u;a+=1){var c=i[a],h=d[c],o=h&&h[1];i[a]=o?{regex:h&&h[0],parser:o}:c.replace(/^\[|\]$/g,"")}return function(t){for(var r={},n=0,e=0;n<u;n+=1){var s=i[n];if("string"==typeof s)e+=s.length;else{var a=s.regex,c=s.parser,h=t.slice(e),o=a.exec(h)[0];c.call(r,o),t=t.replace(o,"")}}return function(t){var r=t.afternoon;if(void 0!==r){var n=t.hours;r?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(r),r}}return function(t,r,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(a=t.parseTwoDigitYear);var e=r.prototype,i=e.parse;e.parse=function(t){var r=t.date,e=t.utc,u=t.args;this.$u=e;var a=u[1];if("string"==typeof a){var c=!0===u[2],h=!0===u[3],o=c||h,f=u[2];h&&(f=u[2]),s=this.$locale(),!c&&f&&(s=n.Ls[f]),this.$d=function(t,r,n,e){try{if(["x","X"].indexOf(r)>-1)return new Date(("X"===r?1e3:1)*t);var i=M(r)(t),u=i.year,s=i.month,a=i.day,c=i.hours,h=i.minutes,o=i.seconds,f=i.milliseconds,d=i.zone,v=i.week,D=new Date,m=a||(u||s?1:D.getDate()),Y=u||D.getFullYear(),w=0;u&&!s||(w=s>0?s-1:D.getMonth());var l,y=c||0,S=h||0,g=o||0,_=f||0;return d?new Date(Date.UTC(Y,w,m,y,S,g,_+60*d.offset*1e3)):n?new Date(Date.UTC(Y,w,m,y,S,g,_)):(l=new Date(Y,w,m,y,S,g,_),v&&(l=e(l).week(v).toDate()),l)}catch(t){return new Date("")}}(r,a,e,n),this.init(),f&&!0!==f&&(this.$L=this.locale(f).$L),o&&r!=this.format(a)&&(this.$d=new Date("")),s={}}else if(a instanceof Array)for(var d=a.length,v=1;v<=d;v+=1){u[1]=a[v-1];var D=n.apply(this,u);if(D.isValid()){this.$d=D.$d,this.$L=D.$L,this.init();break}v===d&&(this.$d=new Date(""))}else i.call(this,t)}}}()));export{s as c,i as d,t as g}