@everymatrix/general-footer-template 1.52.5 → 1.53.0

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.
Files changed (26) hide show
  1. package/dist/cjs/_commonjsHelpers-0a7b82d9.js +21 -0
  2. package/dist/cjs/custom-clock.cjs.entry.js +27 -2190
  3. package/dist/cjs/custom-content-section.cjs.entry.js +83 -99
  4. package/dist/cjs/general-footer-template.cjs.entry.js +2 -1
  5. package/dist/cjs/general-footer-template.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/components/custom-clock/custom-clock.js +33 -5
  8. package/dist/collection/components/general-footer-template/general-footer-template.js +20 -1
  9. package/dist/esm/_commonjsHelpers-57e89916.js +18 -0
  10. package/dist/esm/custom-clock.entry.js +27 -2190
  11. package/dist/esm/custom-content-section.entry.js +74 -90
  12. package/dist/esm/general-footer-template.entry.js +2 -1
  13. package/dist/esm/general-footer-template.js +1 -1
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/general-footer-template/general-footer-template.esm.js +1 -1
  16. package/dist/general-footer-template/p-65805523.entry.js +1 -0
  17. package/dist/general-footer-template/p-6fe03737.entry.js +8 -0
  18. package/dist/general-footer-template/p-cb65c223.js +1 -0
  19. package/dist/general-footer-template/p-db5af7af.entry.js +1 -0
  20. package/dist/types/components/custom-clock/custom-clock.d.ts +4 -0
  21. package/dist/types/components/general-footer-template/general-footer-template.d.ts +4 -0
  22. package/dist/types/components.d.ts +16 -0
  23. package/package.json +1 -1
  24. package/dist/general-footer-template/p-330130cd.entry.js +0 -1
  25. package/dist/general-footer-template/p-5982a2ca.entry.js +0 -8
  26. package/dist/general-footer-template/p-abce093a.entry.js +0 -1
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-465b4ca9.js');
6
+ const _commonjsHelpers = require('./_commonjsHelpers-0a7b82d9.js');
6
7
 
7
8
  const DEFAULT_LANGUAGE = 'en';
8
9
  const TRANSLATIONS = {
@@ -47,2201 +48,29 @@ const translate = (key, customLang) => {
47
48
  return TRANSLATIONS[(lang !== undefined) && (lang in TRANSLATIONS) ? lang : DEFAULT_LANGUAGE][key];
48
49
  };
49
50
 
50
- function _typeof(o) {
51
- "@babel/helpers - typeof";
51
+ var dayjs_min = {exports: {}};
52
52
 
53
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
54
- return typeof o;
55
- } : function (o) {
56
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
57
- }, _typeof(o);
58
- }
53
+ (function (module, exports) {
54
+ !function(t,e){module.exports=e();}(_commonjsHelpers.commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|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,M={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 e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(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()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$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(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),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()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
55
+ }(dayjs_min));
59
56
 
60
- function toInteger(dirtyNumber) {
61
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
62
- return NaN;
63
- }
64
- var number = Number(dirtyNumber);
65
- if (isNaN(number)) {
66
- return number;
67
- }
68
- return number < 0 ? Math.ceil(number) : Math.floor(number);
69
- }
57
+ const dayjs = dayjs_min.exports;
70
58
 
71
- function requiredArgs(required, args) {
72
- if (args.length < required) {
73
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
74
- }
75
- }
59
+ var utc$1 = {exports: {}};
76
60
 
77
- /**
78
- * @name toDate
79
- * @category Common Helpers
80
- * @summary Convert the given argument to an instance of Date.
81
- *
82
- * @description
83
- * Convert the given argument to an instance of Date.
84
- *
85
- * If the argument is an instance of Date, the function returns its clone.
86
- *
87
- * If the argument is a number, it is treated as a timestamp.
88
- *
89
- * If the argument is none of the above, the function returns Invalid Date.
90
- *
91
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
92
- *
93
- * @param {Date|Number} argument - the value to convert
94
- * @returns {Date} the parsed date in the local time zone
95
- * @throws {TypeError} 1 argument required
96
- *
97
- * @example
98
- * // Clone the date:
99
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
100
- * //=> Tue Feb 11 2014 11:30:30
101
- *
102
- * @example
103
- * // Convert the timestamp to date:
104
- * const result = toDate(1392098430000)
105
- * //=> Tue Feb 11 2014 11:30:30
106
- */
107
- function toDate(argument) {
108
- requiredArgs(1, arguments);
109
- var argStr = Object.prototype.toString.call(argument);
61
+ (function (module, exports) {
62
+ !function(t,i){module.exports=i();}(_commonjsHelpers.commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
63
+ }(utc$1));
110
64
 
111
- // Clone the date
112
- if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
113
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
114
- return new Date(argument.getTime());
115
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
116
- return new Date(argument);
117
- } else {
118
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
119
- // eslint-disable-next-line no-console
120
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
121
- // eslint-disable-next-line no-console
122
- console.warn(new Error().stack);
123
- }
124
- return new Date(NaN);
125
- }
126
- }
127
-
128
- /**
129
- * @name addMilliseconds
130
- * @category Millisecond Helpers
131
- * @summary Add the specified number of milliseconds to the given date.
132
- *
133
- * @description
134
- * Add the specified number of milliseconds to the given date.
135
- *
136
- * @param {Date|Number} date - the date to be changed
137
- * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
138
- * @returns {Date} the new date with the milliseconds added
139
- * @throws {TypeError} 2 arguments required
140
- *
141
- * @example
142
- * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
143
- * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
144
- * //=> Thu Jul 10 2014 12:45:30.750
145
- */
146
- function addMilliseconds(dirtyDate, dirtyAmount) {
147
- requiredArgs(2, arguments);
148
- var timestamp = toDate(dirtyDate).getTime();
149
- var amount = toInteger(dirtyAmount);
150
- return new Date(timestamp + amount);
151
- }
152
-
153
- var defaultOptions = {};
154
- function getDefaultOptions() {
155
- return defaultOptions;
156
- }
157
-
158
- /**
159
- * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
160
- * They usually appear for dates that denote time before the timezones were introduced
161
- * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
162
- * and GMT+01:00:00 after that date)
163
- *
164
- * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
165
- * which would lead to incorrect calculations.
166
- *
167
- * This function returns the timezone offset in milliseconds that takes seconds in account.
168
- */
169
- function getTimezoneOffsetInMilliseconds(date) {
170
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
171
- utcDate.setUTCFullYear(date.getFullYear());
172
- return date.getTime() - utcDate.getTime();
173
- }
174
-
175
- /**
176
- * @name isDate
177
- * @category Common Helpers
178
- * @summary Is the given value a date?
179
- *
180
- * @description
181
- * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
182
- *
183
- * @param {*} value - the value to check
184
- * @returns {boolean} true if the given value is a date
185
- * @throws {TypeError} 1 arguments required
186
- *
187
- * @example
188
- * // For a valid date:
189
- * const result = isDate(new Date())
190
- * //=> true
191
- *
192
- * @example
193
- * // For an invalid date:
194
- * const result = isDate(new Date(NaN))
195
- * //=> true
196
- *
197
- * @example
198
- * // For some value:
199
- * const result = isDate('2014-02-31')
200
- * //=> false
201
- *
202
- * @example
203
- * // For an object:
204
- * const result = isDate({})
205
- * //=> false
206
- */
207
- function isDate(value) {
208
- requiredArgs(1, arguments);
209
- return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
210
- }
211
-
212
- /**
213
- * @name isValid
214
- * @category Common Helpers
215
- * @summary Is the given date valid?
216
- *
217
- * @description
218
- * Returns false if argument is Invalid Date and true otherwise.
219
- * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
220
- * Invalid Date is a Date, whose time value is NaN.
221
- *
222
- * Time value of Date: http://es5.github.io/#x15.9.1.1
223
- *
224
- * @param {*} date - the date to check
225
- * @returns {Boolean} the date is valid
226
- * @throws {TypeError} 1 argument required
227
- *
228
- * @example
229
- * // For the valid date:
230
- * const result = isValid(new Date(2014, 1, 31))
231
- * //=> true
232
- *
233
- * @example
234
- * // For the value, convertable into a date:
235
- * const result = isValid(1393804800000)
236
- * //=> true
237
- *
238
- * @example
239
- * // For the invalid date:
240
- * const result = isValid(new Date(''))
241
- * //=> false
242
- */
243
- function isValid(dirtyDate) {
244
- requiredArgs(1, arguments);
245
- if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
246
- return false;
247
- }
248
- var date = toDate(dirtyDate);
249
- return !isNaN(Number(date));
250
- }
251
-
252
- /**
253
- * @name subMilliseconds
254
- * @category Millisecond Helpers
255
- * @summary Subtract the specified number of milliseconds from the given date.
256
- *
257
- * @description
258
- * Subtract the specified number of milliseconds from the given date.
259
- *
260
- * @param {Date|Number} date - the date to be changed
261
- * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
262
- * @returns {Date} the new date with the milliseconds subtracted
263
- * @throws {TypeError} 2 arguments required
264
- *
265
- * @example
266
- * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
267
- * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
268
- * //=> Thu Jul 10 2014 12:45:29.250
269
- */
270
- function subMilliseconds(dirtyDate, dirtyAmount) {
271
- requiredArgs(2, arguments);
272
- var amount = toInteger(dirtyAmount);
273
- return addMilliseconds(dirtyDate, -amount);
274
- }
275
-
276
- var MILLISECONDS_IN_DAY = 86400000;
277
- function getUTCDayOfYear(dirtyDate) {
278
- requiredArgs(1, arguments);
279
- var date = toDate(dirtyDate);
280
- var timestamp = date.getTime();
281
- date.setUTCMonth(0, 1);
282
- date.setUTCHours(0, 0, 0, 0);
283
- var startOfYearTimestamp = date.getTime();
284
- var difference = timestamp - startOfYearTimestamp;
285
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
286
- }
287
-
288
- function startOfUTCISOWeek(dirtyDate) {
289
- requiredArgs(1, arguments);
290
- var weekStartsOn = 1;
291
- var date = toDate(dirtyDate);
292
- var day = date.getUTCDay();
293
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
294
- date.setUTCDate(date.getUTCDate() - diff);
295
- date.setUTCHours(0, 0, 0, 0);
296
- return date;
297
- }
298
-
299
- function getUTCISOWeekYear(dirtyDate) {
300
- requiredArgs(1, arguments);
301
- var date = toDate(dirtyDate);
302
- var year = date.getUTCFullYear();
303
- var fourthOfJanuaryOfNextYear = new Date(0);
304
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
305
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
306
- var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
307
- var fourthOfJanuaryOfThisYear = new Date(0);
308
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
309
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
310
- var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
311
- if (date.getTime() >= startOfNextYear.getTime()) {
312
- return year + 1;
313
- } else if (date.getTime() >= startOfThisYear.getTime()) {
314
- return year;
315
- } else {
316
- return year - 1;
317
- }
318
- }
319
-
320
- function startOfUTCISOWeekYear(dirtyDate) {
321
- requiredArgs(1, arguments);
322
- var year = getUTCISOWeekYear(dirtyDate);
323
- var fourthOfJanuary = new Date(0);
324
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
325
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
326
- var date = startOfUTCISOWeek(fourthOfJanuary);
327
- return date;
328
- }
329
-
330
- var MILLISECONDS_IN_WEEK$1 = 604800000;
331
- function getUTCISOWeek(dirtyDate) {
332
- requiredArgs(1, arguments);
333
- var date = toDate(dirtyDate);
334
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
335
-
336
- // Round the number of days to the nearest integer
337
- // because the number of milliseconds in a week is not constant
338
- // (e.g. it's different in the week of the daylight saving time clock shift)
339
- return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
340
- }
341
-
342
- function startOfUTCWeek(dirtyDate, options) {
343
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
344
- requiredArgs(1, arguments);
345
- var defaultOptions = getDefaultOptions();
346
- var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
347
-
348
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
349
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
350
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
351
- }
352
- var date = toDate(dirtyDate);
353
- var day = date.getUTCDay();
354
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
355
- date.setUTCDate(date.getUTCDate() - diff);
356
- date.setUTCHours(0, 0, 0, 0);
357
- return date;
358
- }
359
-
360
- function getUTCWeekYear(dirtyDate, options) {
361
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
362
- requiredArgs(1, arguments);
363
- var date = toDate(dirtyDate);
364
- var year = date.getUTCFullYear();
365
- var defaultOptions = getDefaultOptions();
366
- var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
367
-
368
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
369
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
370
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
371
- }
372
- var firstWeekOfNextYear = new Date(0);
373
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
374
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
375
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
376
- var firstWeekOfThisYear = new Date(0);
377
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
378
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
379
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
380
- if (date.getTime() >= startOfNextYear.getTime()) {
381
- return year + 1;
382
- } else if (date.getTime() >= startOfThisYear.getTime()) {
383
- return year;
384
- } else {
385
- return year - 1;
386
- }
387
- }
388
-
389
- function startOfUTCWeekYear(dirtyDate, options) {
390
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
391
- requiredArgs(1, arguments);
392
- var defaultOptions = getDefaultOptions();
393
- var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
394
- var year = getUTCWeekYear(dirtyDate, options);
395
- var firstWeek = new Date(0);
396
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
397
- firstWeek.setUTCHours(0, 0, 0, 0);
398
- var date = startOfUTCWeek(firstWeek, options);
399
- return date;
400
- }
401
-
402
- var MILLISECONDS_IN_WEEK = 604800000;
403
- function getUTCWeek(dirtyDate, options) {
404
- requiredArgs(1, arguments);
405
- var date = toDate(dirtyDate);
406
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
407
-
408
- // Round the number of days to the nearest integer
409
- // because the number of milliseconds in a week is not constant
410
- // (e.g. it's different in the week of the daylight saving time clock shift)
411
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
412
- }
413
-
414
- function addLeadingZeros(number, targetLength) {
415
- var sign = number < 0 ? '-' : '';
416
- var output = Math.abs(number).toString();
417
- while (output.length < targetLength) {
418
- output = '0' + output;
419
- }
420
- return sign + output;
421
- }
422
-
423
- /*
424
- * | | Unit | | Unit |
425
- * |-----|--------------------------------|-----|--------------------------------|
426
- * | a | AM, PM | A* | |
427
- * | d | Day of month | D | |
428
- * | h | Hour [1-12] | H | Hour [0-23] |
429
- * | m | Minute | M | Month |
430
- * | s | Second | S | Fraction of second |
431
- * | y | Year (abs) | Y | |
432
- *
433
- * Letters marked by * are not implemented but reserved by Unicode standard.
434
- */
435
- var formatters$2 = {
436
- // Year
437
- y: function y(date, token) {
438
- // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
439
- // | Year | y | yy | yyy | yyyy | yyyyy |
440
- // |----------|-------|----|-------|-------|-------|
441
- // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
442
- // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
443
- // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
444
- // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
445
- // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
446
-
447
- var signedYear = date.getUTCFullYear();
448
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
449
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
450
- return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
451
- },
452
- // Month
453
- M: function M(date, token) {
454
- var month = date.getUTCMonth();
455
- return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
456
- },
457
- // Day of the month
458
- d: function d(date, token) {
459
- return addLeadingZeros(date.getUTCDate(), token.length);
460
- },
461
- // AM or PM
462
- a: function a(date, token) {
463
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
464
- switch (token) {
465
- case 'a':
466
- case 'aa':
467
- return dayPeriodEnumValue.toUpperCase();
468
- case 'aaa':
469
- return dayPeriodEnumValue;
470
- case 'aaaaa':
471
- return dayPeriodEnumValue[0];
472
- case 'aaaa':
473
- default:
474
- return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
475
- }
476
- },
477
- // Hour [1-12]
478
- h: function h(date, token) {
479
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
480
- },
481
- // Hour [0-23]
482
- H: function H(date, token) {
483
- return addLeadingZeros(date.getUTCHours(), token.length);
484
- },
485
- // Minute
486
- m: function m(date, token) {
487
- return addLeadingZeros(date.getUTCMinutes(), token.length);
488
- },
489
- // Second
490
- s: function s(date, token) {
491
- return addLeadingZeros(date.getUTCSeconds(), token.length);
492
- },
493
- // Fraction of second
494
- S: function S(date, token) {
495
- var numberOfDigits = token.length;
496
- var milliseconds = date.getUTCMilliseconds();
497
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
498
- return addLeadingZeros(fractionalSeconds, token.length);
499
- }
500
- };
501
- const formatters$3 = formatters$2;
502
-
503
- var dayPeriodEnum = {
504
- am: 'am',
505
- pm: 'pm',
506
- midnight: 'midnight',
507
- noon: 'noon',
508
- morning: 'morning',
509
- afternoon: 'afternoon',
510
- evening: 'evening',
511
- night: 'night'
512
- };
513
- /*
514
- * | | Unit | | Unit |
515
- * |-----|--------------------------------|-----|--------------------------------|
516
- * | a | AM, PM | A* | Milliseconds in day |
517
- * | b | AM, PM, noon, midnight | B | Flexible day period |
518
- * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
519
- * | d | Day of month | D | Day of year |
520
- * | e | Local day of week | E | Day of week |
521
- * | f | | F* | Day of week in month |
522
- * | g* | Modified Julian day | G | Era |
523
- * | h | Hour [1-12] | H | Hour [0-23] |
524
- * | i! | ISO day of week | I! | ISO week of year |
525
- * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
526
- * | k | Hour [1-24] | K | Hour [0-11] |
527
- * | l* | (deprecated) | L | Stand-alone month |
528
- * | m | Minute | M | Month |
529
- * | n | | N | |
530
- * | o! | Ordinal number modifier | O | Timezone (GMT) |
531
- * | p! | Long localized time | P! | Long localized date |
532
- * | q | Stand-alone quarter | Q | Quarter |
533
- * | r* | Related Gregorian year | R! | ISO week-numbering year |
534
- * | s | Second | S | Fraction of second |
535
- * | t! | Seconds timestamp | T! | Milliseconds timestamp |
536
- * | u | Extended year | U* | Cyclic year |
537
- * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
538
- * | w | Local week of year | W* | Week of month |
539
- * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
540
- * | y | Year (abs) | Y | Local week-numbering year |
541
- * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
542
- *
543
- * Letters marked by * are not implemented but reserved by Unicode standard.
544
- *
545
- * Letters marked by ! are non-standard, but implemented by date-fns:
546
- * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
547
- * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
548
- * i.e. 7 for Sunday, 1 for Monday, etc.
549
- * - `I` is ISO week of year, as opposed to `w` which is local week of year.
550
- * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
551
- * `R` is supposed to be used in conjunction with `I` and `i`
552
- * for universal ISO week-numbering date, whereas
553
- * `Y` is supposed to be used in conjunction with `w` and `e`
554
- * for week-numbering date specific to the locale.
555
- * - `P` is long localized date format
556
- * - `p` is long localized time format
557
- */
558
-
559
- var formatters = {
560
- // Era
561
- G: function G(date, token, localize) {
562
- var era = date.getUTCFullYear() > 0 ? 1 : 0;
563
- switch (token) {
564
- // AD, BC
565
- case 'G':
566
- case 'GG':
567
- case 'GGG':
568
- return localize.era(era, {
569
- width: 'abbreviated'
570
- });
571
- // A, B
572
- case 'GGGGG':
573
- return localize.era(era, {
574
- width: 'narrow'
575
- });
576
- // Anno Domini, Before Christ
577
- case 'GGGG':
578
- default:
579
- return localize.era(era, {
580
- width: 'wide'
581
- });
582
- }
583
- },
584
- // Year
585
- y: function y(date, token, localize) {
586
- // Ordinal number
587
- if (token === 'yo') {
588
- var signedYear = date.getUTCFullYear();
589
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
590
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
591
- return localize.ordinalNumber(year, {
592
- unit: 'year'
593
- });
594
- }
595
- return formatters$3.y(date, token);
596
- },
597
- // Local week-numbering year
598
- Y: function Y(date, token, localize, options) {
599
- var signedWeekYear = getUTCWeekYear(date, options);
600
- // Returns 1 for 1 BC (which is year 0 in JavaScript)
601
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
602
-
603
- // Two digit year
604
- if (token === 'YY') {
605
- var twoDigitYear = weekYear % 100;
606
- return addLeadingZeros(twoDigitYear, 2);
607
- }
608
-
609
- // Ordinal number
610
- if (token === 'Yo') {
611
- return localize.ordinalNumber(weekYear, {
612
- unit: 'year'
613
- });
614
- }
615
-
616
- // Padding
617
- return addLeadingZeros(weekYear, token.length);
618
- },
619
- // ISO week-numbering year
620
- R: function R(date, token) {
621
- var isoWeekYear = getUTCISOWeekYear(date);
622
-
623
- // Padding
624
- return addLeadingZeros(isoWeekYear, token.length);
625
- },
626
- // Extended year. This is a single number designating the year of this calendar system.
627
- // The main difference between `y` and `u` localizers are B.C. years:
628
- // | Year | `y` | `u` |
629
- // |------|-----|-----|
630
- // | AC 1 | 1 | 1 |
631
- // | BC 1 | 1 | 0 |
632
- // | BC 2 | 2 | -1 |
633
- // Also `yy` always returns the last two digits of a year,
634
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
635
- u: function u(date, token) {
636
- var year = date.getUTCFullYear();
637
- return addLeadingZeros(year, token.length);
638
- },
639
- // Quarter
640
- Q: function Q(date, token, localize) {
641
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
642
- switch (token) {
643
- // 1, 2, 3, 4
644
- case 'Q':
645
- return String(quarter);
646
- // 01, 02, 03, 04
647
- case 'QQ':
648
- return addLeadingZeros(quarter, 2);
649
- // 1st, 2nd, 3rd, 4th
650
- case 'Qo':
651
- return localize.ordinalNumber(quarter, {
652
- unit: 'quarter'
653
- });
654
- // Q1, Q2, Q3, Q4
655
- case 'QQQ':
656
- return localize.quarter(quarter, {
657
- width: 'abbreviated',
658
- context: 'formatting'
659
- });
660
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
661
- case 'QQQQQ':
662
- return localize.quarter(quarter, {
663
- width: 'narrow',
664
- context: 'formatting'
665
- });
666
- // 1st quarter, 2nd quarter, ...
667
- case 'QQQQ':
668
- default:
669
- return localize.quarter(quarter, {
670
- width: 'wide',
671
- context: 'formatting'
672
- });
673
- }
674
- },
675
- // Stand-alone quarter
676
- q: function q(date, token, localize) {
677
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
678
- switch (token) {
679
- // 1, 2, 3, 4
680
- case 'q':
681
- return String(quarter);
682
- // 01, 02, 03, 04
683
- case 'qq':
684
- return addLeadingZeros(quarter, 2);
685
- // 1st, 2nd, 3rd, 4th
686
- case 'qo':
687
- return localize.ordinalNumber(quarter, {
688
- unit: 'quarter'
689
- });
690
- // Q1, Q2, Q3, Q4
691
- case 'qqq':
692
- return localize.quarter(quarter, {
693
- width: 'abbreviated',
694
- context: 'standalone'
695
- });
696
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
697
- case 'qqqqq':
698
- return localize.quarter(quarter, {
699
- width: 'narrow',
700
- context: 'standalone'
701
- });
702
- // 1st quarter, 2nd quarter, ...
703
- case 'qqqq':
704
- default:
705
- return localize.quarter(quarter, {
706
- width: 'wide',
707
- context: 'standalone'
708
- });
709
- }
710
- },
711
- // Month
712
- M: function M(date, token, localize) {
713
- var month = date.getUTCMonth();
714
- switch (token) {
715
- case 'M':
716
- case 'MM':
717
- return formatters$3.M(date, token);
718
- // 1st, 2nd, ..., 12th
719
- case 'Mo':
720
- return localize.ordinalNumber(month + 1, {
721
- unit: 'month'
722
- });
723
- // Jan, Feb, ..., Dec
724
- case 'MMM':
725
- return localize.month(month, {
726
- width: 'abbreviated',
727
- context: 'formatting'
728
- });
729
- // J, F, ..., D
730
- case 'MMMMM':
731
- return localize.month(month, {
732
- width: 'narrow',
733
- context: 'formatting'
734
- });
735
- // January, February, ..., December
736
- case 'MMMM':
737
- default:
738
- return localize.month(month, {
739
- width: 'wide',
740
- context: 'formatting'
741
- });
742
- }
743
- },
744
- // Stand-alone month
745
- L: function L(date, token, localize) {
746
- var month = date.getUTCMonth();
747
- switch (token) {
748
- // 1, 2, ..., 12
749
- case 'L':
750
- return String(month + 1);
751
- // 01, 02, ..., 12
752
- case 'LL':
753
- return addLeadingZeros(month + 1, 2);
754
- // 1st, 2nd, ..., 12th
755
- case 'Lo':
756
- return localize.ordinalNumber(month + 1, {
757
- unit: 'month'
758
- });
759
- // Jan, Feb, ..., Dec
760
- case 'LLL':
761
- return localize.month(month, {
762
- width: 'abbreviated',
763
- context: 'standalone'
764
- });
765
- // J, F, ..., D
766
- case 'LLLLL':
767
- return localize.month(month, {
768
- width: 'narrow',
769
- context: 'standalone'
770
- });
771
- // January, February, ..., December
772
- case 'LLLL':
773
- default:
774
- return localize.month(month, {
775
- width: 'wide',
776
- context: 'standalone'
777
- });
778
- }
779
- },
780
- // Local week of year
781
- w: function w(date, token, localize, options) {
782
- var week = getUTCWeek(date, options);
783
- if (token === 'wo') {
784
- return localize.ordinalNumber(week, {
785
- unit: 'week'
786
- });
787
- }
788
- return addLeadingZeros(week, token.length);
789
- },
790
- // ISO week of year
791
- I: function I(date, token, localize) {
792
- var isoWeek = getUTCISOWeek(date);
793
- if (token === 'Io') {
794
- return localize.ordinalNumber(isoWeek, {
795
- unit: 'week'
796
- });
797
- }
798
- return addLeadingZeros(isoWeek, token.length);
799
- },
800
- // Day of the month
801
- d: function d(date, token, localize) {
802
- if (token === 'do') {
803
- return localize.ordinalNumber(date.getUTCDate(), {
804
- unit: 'date'
805
- });
806
- }
807
- return formatters$3.d(date, token);
808
- },
809
- // Day of year
810
- D: function D(date, token, localize) {
811
- var dayOfYear = getUTCDayOfYear(date);
812
- if (token === 'Do') {
813
- return localize.ordinalNumber(dayOfYear, {
814
- unit: 'dayOfYear'
815
- });
816
- }
817
- return addLeadingZeros(dayOfYear, token.length);
818
- },
819
- // Day of week
820
- E: function E(date, token, localize) {
821
- var dayOfWeek = date.getUTCDay();
822
- switch (token) {
823
- // Tue
824
- case 'E':
825
- case 'EE':
826
- case 'EEE':
827
- return localize.day(dayOfWeek, {
828
- width: 'abbreviated',
829
- context: 'formatting'
830
- });
831
- // T
832
- case 'EEEEE':
833
- return localize.day(dayOfWeek, {
834
- width: 'narrow',
835
- context: 'formatting'
836
- });
837
- // Tu
838
- case 'EEEEEE':
839
- return localize.day(dayOfWeek, {
840
- width: 'short',
841
- context: 'formatting'
842
- });
843
- // Tuesday
844
- case 'EEEE':
845
- default:
846
- return localize.day(dayOfWeek, {
847
- width: 'wide',
848
- context: 'formatting'
849
- });
850
- }
851
- },
852
- // Local day of week
853
- e: function e(date, token, localize, options) {
854
- var dayOfWeek = date.getUTCDay();
855
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
856
- switch (token) {
857
- // Numerical value (Nth day of week with current locale or weekStartsOn)
858
- case 'e':
859
- return String(localDayOfWeek);
860
- // Padded numerical value
861
- case 'ee':
862
- return addLeadingZeros(localDayOfWeek, 2);
863
- // 1st, 2nd, ..., 7th
864
- case 'eo':
865
- return localize.ordinalNumber(localDayOfWeek, {
866
- unit: 'day'
867
- });
868
- case 'eee':
869
- return localize.day(dayOfWeek, {
870
- width: 'abbreviated',
871
- context: 'formatting'
872
- });
873
- // T
874
- case 'eeeee':
875
- return localize.day(dayOfWeek, {
876
- width: 'narrow',
877
- context: 'formatting'
878
- });
879
- // Tu
880
- case 'eeeeee':
881
- return localize.day(dayOfWeek, {
882
- width: 'short',
883
- context: 'formatting'
884
- });
885
- // Tuesday
886
- case 'eeee':
887
- default:
888
- return localize.day(dayOfWeek, {
889
- width: 'wide',
890
- context: 'formatting'
891
- });
892
- }
893
- },
894
- // Stand-alone local day of week
895
- c: function c(date, token, localize, options) {
896
- var dayOfWeek = date.getUTCDay();
897
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
898
- switch (token) {
899
- // Numerical value (same as in `e`)
900
- case 'c':
901
- return String(localDayOfWeek);
902
- // Padded numerical value
903
- case 'cc':
904
- return addLeadingZeros(localDayOfWeek, token.length);
905
- // 1st, 2nd, ..., 7th
906
- case 'co':
907
- return localize.ordinalNumber(localDayOfWeek, {
908
- unit: 'day'
909
- });
910
- case 'ccc':
911
- return localize.day(dayOfWeek, {
912
- width: 'abbreviated',
913
- context: 'standalone'
914
- });
915
- // T
916
- case 'ccccc':
917
- return localize.day(dayOfWeek, {
918
- width: 'narrow',
919
- context: 'standalone'
920
- });
921
- // Tu
922
- case 'cccccc':
923
- return localize.day(dayOfWeek, {
924
- width: 'short',
925
- context: 'standalone'
926
- });
927
- // Tuesday
928
- case 'cccc':
929
- default:
930
- return localize.day(dayOfWeek, {
931
- width: 'wide',
932
- context: 'standalone'
933
- });
934
- }
935
- },
936
- // ISO day of week
937
- i: function i(date, token, localize) {
938
- var dayOfWeek = date.getUTCDay();
939
- var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
940
- switch (token) {
941
- // 2
942
- case 'i':
943
- return String(isoDayOfWeek);
944
- // 02
945
- case 'ii':
946
- return addLeadingZeros(isoDayOfWeek, token.length);
947
- // 2nd
948
- case 'io':
949
- return localize.ordinalNumber(isoDayOfWeek, {
950
- unit: 'day'
951
- });
952
- // Tue
953
- case 'iii':
954
- return localize.day(dayOfWeek, {
955
- width: 'abbreviated',
956
- context: 'formatting'
957
- });
958
- // T
959
- case 'iiiii':
960
- return localize.day(dayOfWeek, {
961
- width: 'narrow',
962
- context: 'formatting'
963
- });
964
- // Tu
965
- case 'iiiiii':
966
- return localize.day(dayOfWeek, {
967
- width: 'short',
968
- context: 'formatting'
969
- });
970
- // Tuesday
971
- case 'iiii':
972
- default:
973
- return localize.day(dayOfWeek, {
974
- width: 'wide',
975
- context: 'formatting'
976
- });
977
- }
978
- },
979
- // AM or PM
980
- a: function a(date, token, localize) {
981
- var hours = date.getUTCHours();
982
- var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
983
- switch (token) {
984
- case 'a':
985
- case 'aa':
986
- return localize.dayPeriod(dayPeriodEnumValue, {
987
- width: 'abbreviated',
988
- context: 'formatting'
989
- });
990
- case 'aaa':
991
- return localize.dayPeriod(dayPeriodEnumValue, {
992
- width: 'abbreviated',
993
- context: 'formatting'
994
- }).toLowerCase();
995
- case 'aaaaa':
996
- return localize.dayPeriod(dayPeriodEnumValue, {
997
- width: 'narrow',
998
- context: 'formatting'
999
- });
1000
- case 'aaaa':
1001
- default:
1002
- return localize.dayPeriod(dayPeriodEnumValue, {
1003
- width: 'wide',
1004
- context: 'formatting'
1005
- });
1006
- }
1007
- },
1008
- // AM, PM, midnight, noon
1009
- b: function b(date, token, localize) {
1010
- var hours = date.getUTCHours();
1011
- var dayPeriodEnumValue;
1012
- if (hours === 12) {
1013
- dayPeriodEnumValue = dayPeriodEnum.noon;
1014
- } else if (hours === 0) {
1015
- dayPeriodEnumValue = dayPeriodEnum.midnight;
1016
- } else {
1017
- dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1018
- }
1019
- switch (token) {
1020
- case 'b':
1021
- case 'bb':
1022
- return localize.dayPeriod(dayPeriodEnumValue, {
1023
- width: 'abbreviated',
1024
- context: 'formatting'
1025
- });
1026
- case 'bbb':
1027
- return localize.dayPeriod(dayPeriodEnumValue, {
1028
- width: 'abbreviated',
1029
- context: 'formatting'
1030
- }).toLowerCase();
1031
- case 'bbbbb':
1032
- return localize.dayPeriod(dayPeriodEnumValue, {
1033
- width: 'narrow',
1034
- context: 'formatting'
1035
- });
1036
- case 'bbbb':
1037
- default:
1038
- return localize.dayPeriod(dayPeriodEnumValue, {
1039
- width: 'wide',
1040
- context: 'formatting'
1041
- });
1042
- }
1043
- },
1044
- // in the morning, in the afternoon, in the evening, at night
1045
- B: function B(date, token, localize) {
1046
- var hours = date.getUTCHours();
1047
- var dayPeriodEnumValue;
1048
- if (hours >= 17) {
1049
- dayPeriodEnumValue = dayPeriodEnum.evening;
1050
- } else if (hours >= 12) {
1051
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
1052
- } else if (hours >= 4) {
1053
- dayPeriodEnumValue = dayPeriodEnum.morning;
1054
- } else {
1055
- dayPeriodEnumValue = dayPeriodEnum.night;
1056
- }
1057
- switch (token) {
1058
- case 'B':
1059
- case 'BB':
1060
- case 'BBB':
1061
- return localize.dayPeriod(dayPeriodEnumValue, {
1062
- width: 'abbreviated',
1063
- context: 'formatting'
1064
- });
1065
- case 'BBBBB':
1066
- return localize.dayPeriod(dayPeriodEnumValue, {
1067
- width: 'narrow',
1068
- context: 'formatting'
1069
- });
1070
- case 'BBBB':
1071
- default:
1072
- return localize.dayPeriod(dayPeriodEnumValue, {
1073
- width: 'wide',
1074
- context: 'formatting'
1075
- });
1076
- }
1077
- },
1078
- // Hour [1-12]
1079
- h: function h(date, token, localize) {
1080
- if (token === 'ho') {
1081
- var hours = date.getUTCHours() % 12;
1082
- if (hours === 0) hours = 12;
1083
- return localize.ordinalNumber(hours, {
1084
- unit: 'hour'
1085
- });
1086
- }
1087
- return formatters$3.h(date, token);
1088
- },
1089
- // Hour [0-23]
1090
- H: function H(date, token, localize) {
1091
- if (token === 'Ho') {
1092
- return localize.ordinalNumber(date.getUTCHours(), {
1093
- unit: 'hour'
1094
- });
1095
- }
1096
- return formatters$3.H(date, token);
1097
- },
1098
- // Hour [0-11]
1099
- K: function K(date, token, localize) {
1100
- var hours = date.getUTCHours() % 12;
1101
- if (token === 'Ko') {
1102
- return localize.ordinalNumber(hours, {
1103
- unit: 'hour'
1104
- });
1105
- }
1106
- return addLeadingZeros(hours, token.length);
1107
- },
1108
- // Hour [1-24]
1109
- k: function k(date, token, localize) {
1110
- var hours = date.getUTCHours();
1111
- if (hours === 0) hours = 24;
1112
- if (token === 'ko') {
1113
- return localize.ordinalNumber(hours, {
1114
- unit: 'hour'
1115
- });
1116
- }
1117
- return addLeadingZeros(hours, token.length);
1118
- },
1119
- // Minute
1120
- m: function m(date, token, localize) {
1121
- if (token === 'mo') {
1122
- return localize.ordinalNumber(date.getUTCMinutes(), {
1123
- unit: 'minute'
1124
- });
1125
- }
1126
- return formatters$3.m(date, token);
1127
- },
1128
- // Second
1129
- s: function s(date, token, localize) {
1130
- if (token === 'so') {
1131
- return localize.ordinalNumber(date.getUTCSeconds(), {
1132
- unit: 'second'
1133
- });
1134
- }
1135
- return formatters$3.s(date, token);
1136
- },
1137
- // Fraction of second
1138
- S: function S(date, token) {
1139
- return formatters$3.S(date, token);
1140
- },
1141
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1142
- X: function X(date, token, _localize, options) {
1143
- var originalDate = options._originalDate || date;
1144
- var timezoneOffset = originalDate.getTimezoneOffset();
1145
- if (timezoneOffset === 0) {
1146
- return 'Z';
1147
- }
1148
- switch (token) {
1149
- // Hours and optional minutes
1150
- case 'X':
1151
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
1152
-
1153
- // Hours, minutes and optional seconds without `:` delimiter
1154
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1155
- // so this token always has the same output as `XX`
1156
- case 'XXXX':
1157
- case 'XX':
1158
- // Hours and minutes without `:` delimiter
1159
- return formatTimezone(timezoneOffset);
1160
-
1161
- // Hours, minutes and optional seconds with `:` delimiter
1162
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1163
- // so this token always has the same output as `XXX`
1164
- case 'XXXXX':
1165
- case 'XXX': // Hours and minutes with `:` delimiter
1166
- default:
1167
- return formatTimezone(timezoneOffset, ':');
1168
- }
1169
- },
1170
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1171
- x: function x(date, token, _localize, options) {
1172
- var originalDate = options._originalDate || date;
1173
- var timezoneOffset = originalDate.getTimezoneOffset();
1174
- switch (token) {
1175
- // Hours and optional minutes
1176
- case 'x':
1177
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
1178
-
1179
- // Hours, minutes and optional seconds without `:` delimiter
1180
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1181
- // so this token always has the same output as `xx`
1182
- case 'xxxx':
1183
- case 'xx':
1184
- // Hours and minutes without `:` delimiter
1185
- return formatTimezone(timezoneOffset);
1186
-
1187
- // Hours, minutes and optional seconds with `:` delimiter
1188
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1189
- // so this token always has the same output as `xxx`
1190
- case 'xxxxx':
1191
- case 'xxx': // Hours and minutes with `:` delimiter
1192
- default:
1193
- return formatTimezone(timezoneOffset, ':');
1194
- }
1195
- },
1196
- // Timezone (GMT)
1197
- O: function O(date, token, _localize, options) {
1198
- var originalDate = options._originalDate || date;
1199
- var timezoneOffset = originalDate.getTimezoneOffset();
1200
- switch (token) {
1201
- // Short
1202
- case 'O':
1203
- case 'OO':
1204
- case 'OOO':
1205
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1206
- // Long
1207
- case 'OOOO':
1208
- default:
1209
- return 'GMT' + formatTimezone(timezoneOffset, ':');
1210
- }
1211
- },
1212
- // Timezone (specific non-location)
1213
- z: function z(date, token, _localize, options) {
1214
- var originalDate = options._originalDate || date;
1215
- var timezoneOffset = originalDate.getTimezoneOffset();
1216
- switch (token) {
1217
- // Short
1218
- case 'z':
1219
- case 'zz':
1220
- case 'zzz':
1221
- return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1222
- // Long
1223
- case 'zzzz':
1224
- default:
1225
- return 'GMT' + formatTimezone(timezoneOffset, ':');
1226
- }
1227
- },
1228
- // Seconds timestamp
1229
- t: function t(date, token, _localize, options) {
1230
- var originalDate = options._originalDate || date;
1231
- var timestamp = Math.floor(originalDate.getTime() / 1000);
1232
- return addLeadingZeros(timestamp, token.length);
1233
- },
1234
- // Milliseconds timestamp
1235
- T: function T(date, token, _localize, options) {
1236
- var originalDate = options._originalDate || date;
1237
- var timestamp = originalDate.getTime();
1238
- return addLeadingZeros(timestamp, token.length);
1239
- }
1240
- };
1241
- function formatTimezoneShort(offset, dirtyDelimiter) {
1242
- var sign = offset > 0 ? '-' : '+';
1243
- var absOffset = Math.abs(offset);
1244
- var hours = Math.floor(absOffset / 60);
1245
- var minutes = absOffset % 60;
1246
- if (minutes === 0) {
1247
- return sign + String(hours);
1248
- }
1249
- var delimiter = dirtyDelimiter || '';
1250
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1251
- }
1252
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1253
- if (offset % 60 === 0) {
1254
- var sign = offset > 0 ? '-' : '+';
1255
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1256
- }
1257
- return formatTimezone(offset, dirtyDelimiter);
1258
- }
1259
- function formatTimezone(offset, dirtyDelimiter) {
1260
- var delimiter = dirtyDelimiter || '';
1261
- var sign = offset > 0 ? '-' : '+';
1262
- var absOffset = Math.abs(offset);
1263
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1264
- var minutes = addLeadingZeros(absOffset % 60, 2);
1265
- return sign + hours + delimiter + minutes;
1266
- }
1267
- const formatters$1 = formatters;
1268
-
1269
- var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1270
- switch (pattern) {
1271
- case 'P':
1272
- return formatLong.date({
1273
- width: 'short'
1274
- });
1275
- case 'PP':
1276
- return formatLong.date({
1277
- width: 'medium'
1278
- });
1279
- case 'PPP':
1280
- return formatLong.date({
1281
- width: 'long'
1282
- });
1283
- case 'PPPP':
1284
- default:
1285
- return formatLong.date({
1286
- width: 'full'
1287
- });
1288
- }
1289
- };
1290
- var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1291
- switch (pattern) {
1292
- case 'p':
1293
- return formatLong.time({
1294
- width: 'short'
1295
- });
1296
- case 'pp':
1297
- return formatLong.time({
1298
- width: 'medium'
1299
- });
1300
- case 'ppp':
1301
- return formatLong.time({
1302
- width: 'long'
1303
- });
1304
- case 'pppp':
1305
- default:
1306
- return formatLong.time({
1307
- width: 'full'
1308
- });
1309
- }
1310
- };
1311
- var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1312
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
1313
- var datePattern = matchResult[1];
1314
- var timePattern = matchResult[2];
1315
- if (!timePattern) {
1316
- return dateLongFormatter(pattern, formatLong);
1317
- }
1318
- var dateTimeFormat;
1319
- switch (datePattern) {
1320
- case 'P':
1321
- dateTimeFormat = formatLong.dateTime({
1322
- width: 'short'
1323
- });
1324
- break;
1325
- case 'PP':
1326
- dateTimeFormat = formatLong.dateTime({
1327
- width: 'medium'
1328
- });
1329
- break;
1330
- case 'PPP':
1331
- dateTimeFormat = formatLong.dateTime({
1332
- width: 'long'
1333
- });
1334
- break;
1335
- case 'PPPP':
1336
- default:
1337
- dateTimeFormat = formatLong.dateTime({
1338
- width: 'full'
1339
- });
1340
- break;
1341
- }
1342
- return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1343
- };
1344
- var longFormatters = {
1345
- p: timeLongFormatter,
1346
- P: dateTimeLongFormatter
1347
- };
1348
- const longFormatters$1 = longFormatters;
1349
-
1350
- var protectedDayOfYearTokens = ['D', 'DD'];
1351
- var protectedWeekYearTokens = ['YY', 'YYYY'];
1352
- function isProtectedDayOfYearToken(token) {
1353
- return protectedDayOfYearTokens.indexOf(token) !== -1;
1354
- }
1355
- function isProtectedWeekYearToken(token) {
1356
- return protectedWeekYearTokens.indexOf(token) !== -1;
1357
- }
1358
- function throwProtectedError(token, format, input) {
1359
- if (token === 'YYYY') {
1360
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1361
- } else if (token === 'YY') {
1362
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1363
- } else if (token === 'D') {
1364
- throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1365
- } else if (token === 'DD') {
1366
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1367
- }
1368
- }
1369
-
1370
- var formatDistanceLocale = {
1371
- lessThanXSeconds: {
1372
- one: 'less than a second',
1373
- other: 'less than {{count}} seconds'
1374
- },
1375
- xSeconds: {
1376
- one: '1 second',
1377
- other: '{{count}} seconds'
1378
- },
1379
- halfAMinute: 'half a minute',
1380
- lessThanXMinutes: {
1381
- one: 'less than a minute',
1382
- other: 'less than {{count}} minutes'
1383
- },
1384
- xMinutes: {
1385
- one: '1 minute',
1386
- other: '{{count}} minutes'
1387
- },
1388
- aboutXHours: {
1389
- one: 'about 1 hour',
1390
- other: 'about {{count}} hours'
1391
- },
1392
- xHours: {
1393
- one: '1 hour',
1394
- other: '{{count}} hours'
1395
- },
1396
- xDays: {
1397
- one: '1 day',
1398
- other: '{{count}} days'
1399
- },
1400
- aboutXWeeks: {
1401
- one: 'about 1 week',
1402
- other: 'about {{count}} weeks'
1403
- },
1404
- xWeeks: {
1405
- one: '1 week',
1406
- other: '{{count}} weeks'
1407
- },
1408
- aboutXMonths: {
1409
- one: 'about 1 month',
1410
- other: 'about {{count}} months'
1411
- },
1412
- xMonths: {
1413
- one: '1 month',
1414
- other: '{{count}} months'
1415
- },
1416
- aboutXYears: {
1417
- one: 'about 1 year',
1418
- other: 'about {{count}} years'
1419
- },
1420
- xYears: {
1421
- one: '1 year',
1422
- other: '{{count}} years'
1423
- },
1424
- overXYears: {
1425
- one: 'over 1 year',
1426
- other: 'over {{count}} years'
1427
- },
1428
- almostXYears: {
1429
- one: 'almost 1 year',
1430
- other: 'almost {{count}} years'
1431
- }
1432
- };
1433
- var formatDistance = function formatDistance(token, count, options) {
1434
- var result;
1435
- var tokenValue = formatDistanceLocale[token];
1436
- if (typeof tokenValue === 'string') {
1437
- result = tokenValue;
1438
- } else if (count === 1) {
1439
- result = tokenValue.one;
1440
- } else {
1441
- result = tokenValue.other.replace('{{count}}', count.toString());
1442
- }
1443
- if (options !== null && options !== void 0 && options.addSuffix) {
1444
- if (options.comparison && options.comparison > 0) {
1445
- return 'in ' + result;
1446
- } else {
1447
- return result + ' ago';
1448
- }
1449
- }
1450
- return result;
1451
- };
1452
- const formatDistance$1 = formatDistance;
1453
-
1454
- function buildFormatLongFn(args) {
1455
- return function () {
1456
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1457
- // TODO: Remove String()
1458
- var width = options.width ? String(options.width) : args.defaultWidth;
1459
- var format = args.formats[width] || args.formats[args.defaultWidth];
1460
- return format;
1461
- };
1462
- }
1463
-
1464
- var dateFormats = {
1465
- full: 'EEEE, MMMM do, y',
1466
- long: 'MMMM do, y',
1467
- medium: 'MMM d, y',
1468
- short: 'MM/dd/yyyy'
1469
- };
1470
- var timeFormats = {
1471
- full: 'h:mm:ss a zzzz',
1472
- long: 'h:mm:ss a z',
1473
- medium: 'h:mm:ss a',
1474
- short: 'h:mm a'
1475
- };
1476
- var dateTimeFormats = {
1477
- full: "{{date}} 'at' {{time}}",
1478
- long: "{{date}} 'at' {{time}}",
1479
- medium: '{{date}}, {{time}}',
1480
- short: '{{date}}, {{time}}'
1481
- };
1482
- var formatLong = {
1483
- date: buildFormatLongFn({
1484
- formats: dateFormats,
1485
- defaultWidth: 'full'
1486
- }),
1487
- time: buildFormatLongFn({
1488
- formats: timeFormats,
1489
- defaultWidth: 'full'
1490
- }),
1491
- dateTime: buildFormatLongFn({
1492
- formats: dateTimeFormats,
1493
- defaultWidth: 'full'
1494
- })
1495
- };
1496
- const formatLong$1 = formatLong;
1497
-
1498
- var formatRelativeLocale = {
1499
- lastWeek: "'last' eeee 'at' p",
1500
- yesterday: "'yesterday at' p",
1501
- today: "'today at' p",
1502
- tomorrow: "'tomorrow at' p",
1503
- nextWeek: "eeee 'at' p",
1504
- other: 'P'
1505
- };
1506
- var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
1507
- return formatRelativeLocale[token];
1508
- };
1509
- const formatRelative$1 = formatRelative;
1510
-
1511
- function buildLocalizeFn(args) {
1512
- return function (dirtyIndex, options) {
1513
- var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1514
- var valuesArray;
1515
- if (context === 'formatting' && args.formattingValues) {
1516
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1517
- var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1518
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1519
- } else {
1520
- var _defaultWidth = args.defaultWidth;
1521
- var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1522
- valuesArray = args.values[_width] || args.values[_defaultWidth];
1523
- }
1524
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1525
- // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
1526
- return valuesArray[index];
1527
- };
1528
- }
1529
-
1530
- var eraValues = {
1531
- narrow: ['B', 'A'],
1532
- abbreviated: ['BC', 'AD'],
1533
- wide: ['Before Christ', 'Anno Domini']
1534
- };
1535
- var quarterValues = {
1536
- narrow: ['1', '2', '3', '4'],
1537
- abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1538
- wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1539
- };
1540
-
1541
- // Note: in English, the names of days of the week and months are capitalized.
1542
- // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1543
- // Generally, formatted dates should look like they are in the middle of a sentence,
1544
- // e.g. in Spanish language the weekdays and months should be in the lowercase.
1545
- var monthValues = {
1546
- narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1547
- abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1548
- wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1549
- };
1550
- var dayValues = {
1551
- narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1552
- short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1553
- abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1554
- wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1555
- };
1556
- var dayPeriodValues = {
1557
- narrow: {
1558
- am: 'a',
1559
- pm: 'p',
1560
- midnight: 'mi',
1561
- noon: 'n',
1562
- morning: 'morning',
1563
- afternoon: 'afternoon',
1564
- evening: 'evening',
1565
- night: 'night'
1566
- },
1567
- abbreviated: {
1568
- am: 'AM',
1569
- pm: 'PM',
1570
- midnight: 'midnight',
1571
- noon: 'noon',
1572
- morning: 'morning',
1573
- afternoon: 'afternoon',
1574
- evening: 'evening',
1575
- night: 'night'
1576
- },
1577
- wide: {
1578
- am: 'a.m.',
1579
- pm: 'p.m.',
1580
- midnight: 'midnight',
1581
- noon: 'noon',
1582
- morning: 'morning',
1583
- afternoon: 'afternoon',
1584
- evening: 'evening',
1585
- night: 'night'
1586
- }
1587
- };
1588
- var formattingDayPeriodValues = {
1589
- narrow: {
1590
- am: 'a',
1591
- pm: 'p',
1592
- midnight: 'mi',
1593
- noon: 'n',
1594
- morning: 'in the morning',
1595
- afternoon: 'in the afternoon',
1596
- evening: 'in the evening',
1597
- night: 'at night'
1598
- },
1599
- abbreviated: {
1600
- am: 'AM',
1601
- pm: 'PM',
1602
- midnight: 'midnight',
1603
- noon: 'noon',
1604
- morning: 'in the morning',
1605
- afternoon: 'in the afternoon',
1606
- evening: 'in the evening',
1607
- night: 'at night'
1608
- },
1609
- wide: {
1610
- am: 'a.m.',
1611
- pm: 'p.m.',
1612
- midnight: 'midnight',
1613
- noon: 'noon',
1614
- morning: 'in the morning',
1615
- afternoon: 'in the afternoon',
1616
- evening: 'in the evening',
1617
- night: 'at night'
1618
- }
1619
- };
1620
- var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
1621
- var number = Number(dirtyNumber);
1622
-
1623
- // If ordinal numbers depend on context, for example,
1624
- // if they are different for different grammatical genders,
1625
- // use `options.unit`.
1626
- //
1627
- // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1628
- // 'day', 'hour', 'minute', 'second'.
1629
-
1630
- var rem100 = number % 100;
1631
- if (rem100 > 20 || rem100 < 10) {
1632
- switch (rem100 % 10) {
1633
- case 1:
1634
- return number + 'st';
1635
- case 2:
1636
- return number + 'nd';
1637
- case 3:
1638
- return number + 'rd';
1639
- }
1640
- }
1641
- return number + 'th';
1642
- };
1643
- var localize = {
1644
- ordinalNumber: ordinalNumber,
1645
- era: buildLocalizeFn({
1646
- values: eraValues,
1647
- defaultWidth: 'wide'
1648
- }),
1649
- quarter: buildLocalizeFn({
1650
- values: quarterValues,
1651
- defaultWidth: 'wide',
1652
- argumentCallback: function argumentCallback(quarter) {
1653
- return quarter - 1;
1654
- }
1655
- }),
1656
- month: buildLocalizeFn({
1657
- values: monthValues,
1658
- defaultWidth: 'wide'
1659
- }),
1660
- day: buildLocalizeFn({
1661
- values: dayValues,
1662
- defaultWidth: 'wide'
1663
- }),
1664
- dayPeriod: buildLocalizeFn({
1665
- values: dayPeriodValues,
1666
- defaultWidth: 'wide',
1667
- formattingValues: formattingDayPeriodValues,
1668
- defaultFormattingWidth: 'wide'
1669
- })
1670
- };
1671
- const localize$1 = localize;
1672
-
1673
- function buildMatchFn(args) {
1674
- return function (string) {
1675
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1676
- var width = options.width;
1677
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1678
- var matchResult = string.match(matchPattern);
1679
- if (!matchResult) {
1680
- return null;
1681
- }
1682
- var matchedString = matchResult[0];
1683
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1684
- var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
1685
- return pattern.test(matchedString);
1686
- }) : findKey(parsePatterns, function (pattern) {
1687
- return pattern.test(matchedString);
1688
- });
1689
- var value;
1690
- value = args.valueCallback ? args.valueCallback(key) : key;
1691
- value = options.valueCallback ? options.valueCallback(value) : value;
1692
- var rest = string.slice(matchedString.length);
1693
- return {
1694
- value: value,
1695
- rest: rest
1696
- };
1697
- };
1698
- }
1699
- function findKey(object, predicate) {
1700
- for (var key in object) {
1701
- if (object.hasOwnProperty(key) && predicate(object[key])) {
1702
- return key;
1703
- }
1704
- }
1705
- return undefined;
1706
- }
1707
- function findIndex(array, predicate) {
1708
- for (var key = 0; key < array.length; key++) {
1709
- if (predicate(array[key])) {
1710
- return key;
1711
- }
1712
- }
1713
- return undefined;
1714
- }
1715
-
1716
- function buildMatchPatternFn(args) {
1717
- return function (string) {
1718
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1719
- var matchResult = string.match(args.matchPattern);
1720
- if (!matchResult) return null;
1721
- var matchedString = matchResult[0];
1722
- var parseResult = string.match(args.parsePattern);
1723
- if (!parseResult) return null;
1724
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1725
- value = options.valueCallback ? options.valueCallback(value) : value;
1726
- var rest = string.slice(matchedString.length);
1727
- return {
1728
- value: value,
1729
- rest: rest
1730
- };
1731
- };
1732
- }
1733
-
1734
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1735
- var parseOrdinalNumberPattern = /\d+/i;
1736
- var matchEraPatterns = {
1737
- narrow: /^(b|a)/i,
1738
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1739
- wide: /^(before christ|before common era|anno domini|common era)/i
1740
- };
1741
- var parseEraPatterns = {
1742
- any: [/^b/i, /^(a|c)/i]
1743
- };
1744
- var matchQuarterPatterns = {
1745
- narrow: /^[1234]/i,
1746
- abbreviated: /^q[1234]/i,
1747
- wide: /^[1234](th|st|nd|rd)? quarter/i
1748
- };
1749
- var parseQuarterPatterns = {
1750
- any: [/1/i, /2/i, /3/i, /4/i]
1751
- };
1752
- var matchMonthPatterns = {
1753
- narrow: /^[jfmasond]/i,
1754
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1755
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
1756
- };
1757
- var parseMonthPatterns = {
1758
- narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
1759
- any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
1760
- };
1761
- var matchDayPatterns = {
1762
- narrow: /^[smtwf]/i,
1763
- short: /^(su|mo|tu|we|th|fr|sa)/i,
1764
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1765
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
1766
- };
1767
- var parseDayPatterns = {
1768
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1769
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
1770
- };
1771
- var matchDayPeriodPatterns = {
1772
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1773
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
1774
- };
1775
- var parseDayPeriodPatterns = {
1776
- any: {
1777
- am: /^a/i,
1778
- pm: /^p/i,
1779
- midnight: /^mi/i,
1780
- noon: /^no/i,
1781
- morning: /morning/i,
1782
- afternoon: /afternoon/i,
1783
- evening: /evening/i,
1784
- night: /night/i
1785
- }
1786
- };
1787
- var match = {
1788
- ordinalNumber: buildMatchPatternFn({
1789
- matchPattern: matchOrdinalNumberPattern,
1790
- parsePattern: parseOrdinalNumberPattern,
1791
- valueCallback: function valueCallback(value) {
1792
- return parseInt(value, 10);
1793
- }
1794
- }),
1795
- era: buildMatchFn({
1796
- matchPatterns: matchEraPatterns,
1797
- defaultMatchWidth: 'wide',
1798
- parsePatterns: parseEraPatterns,
1799
- defaultParseWidth: 'any'
1800
- }),
1801
- quarter: buildMatchFn({
1802
- matchPatterns: matchQuarterPatterns,
1803
- defaultMatchWidth: 'wide',
1804
- parsePatterns: parseQuarterPatterns,
1805
- defaultParseWidth: 'any',
1806
- valueCallback: function valueCallback(index) {
1807
- return index + 1;
1808
- }
1809
- }),
1810
- month: buildMatchFn({
1811
- matchPatterns: matchMonthPatterns,
1812
- defaultMatchWidth: 'wide',
1813
- parsePatterns: parseMonthPatterns,
1814
- defaultParseWidth: 'any'
1815
- }),
1816
- day: buildMatchFn({
1817
- matchPatterns: matchDayPatterns,
1818
- defaultMatchWidth: 'wide',
1819
- parsePatterns: parseDayPatterns,
1820
- defaultParseWidth: 'any'
1821
- }),
1822
- dayPeriod: buildMatchFn({
1823
- matchPatterns: matchDayPeriodPatterns,
1824
- defaultMatchWidth: 'any',
1825
- parsePatterns: parseDayPeriodPatterns,
1826
- defaultParseWidth: 'any'
1827
- })
1828
- };
1829
- const match$1 = match;
1830
-
1831
- /**
1832
- * @type {Locale}
1833
- * @category Locales
1834
- * @summary English locale (United States).
1835
- * @language English
1836
- * @iso-639-2 eng
1837
- * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
1838
- * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
1839
- */
1840
- var locale = {
1841
- code: 'en-US',
1842
- formatDistance: formatDistance$1,
1843
- formatLong: formatLong$1,
1844
- formatRelative: formatRelative$1,
1845
- localize: localize$1,
1846
- match: match$1,
1847
- options: {
1848
- weekStartsOn: 0 /* Sunday */,
1849
- firstWeekContainsDate: 1
1850
- }
1851
- };
1852
- const defaultLocale = locale;
65
+ const utc = utc$1.exports;
1853
66
 
1854
- // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1855
- // (one of the certain letters followed by `o`)
1856
- // - (\w)\1* matches any sequences of the same letter
1857
- // - '' matches two quote characters in a row
1858
- // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1859
- // except a single quote symbol, which ends the sequence.
1860
- // Two quote characters do not end the sequence.
1861
- // If there is no matching single quote
1862
- // then the sequence will continue until the end of the string.
1863
- // - . matches any single character unmatched by previous parts of the RegExps
1864
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
67
+ var timezone$1 = {exports: {}};
1865
68
 
1866
- // This RegExp catches symbols escaped by quotes, and also
1867
- // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1868
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1869
- var escapedStringRegExp = /^'([^]*?)'?$/;
1870
- var doubleQuoteRegExp = /''/g;
1871
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
69
+ (function (module, exports) {
70
+ !function(t,e){module.exports=e();}(_commonjsHelpers.commonjsGlobal,(function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},e={};return function(n,i,o){var r,a=function(t,n,i){void 0===i&&(i={});var o=new Date(t),r=function(t,n){void 0===n&&(n={});var i=n.timeZoneName||"short",o=t+"|"+i,r=e[o];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),e[o]=r),r}(n,i);return r.formatToParts(o)},u=function(e,n){for(var i=a(e,n),r=[],u=0;u<i.length;u+=1){var f=i[u],s=f.type,m=f.value,c=t[s];c>=0&&(r[c]=parseInt(m,10));}var d=r[3],l=24===d?0:d,h=r[0]+"-"+r[1]+"-"+r[2]+" "+l+":"+r[4]+":"+r[5]+":000",v=+e;return (o.utc(h).valueOf()-(v-=v%1e3))/6e4},f=i.prototype;f.tz=function(t,e){void 0===t&&(t=r);var n,i=this.utcOffset(),a=this.toDate(),u=a.toLocaleString("en-US",{timeZone:t}),f=Math.round((a-new Date(u))/1e3/60),s=15*-Math.round(a.getTimezoneOffset()/15)-f;if(!Number(s))n=this.utcOffset(0,e);else if(n=o(u,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(s,!0),e){var m=n.utcOffset();n=n.add(i-m,"minute");}return n.$x.$timezone=t,n},f.offsetName=function(t){var e=this.$x.$timezone||o.tz.guess(),n=a(this.valueOf(),e,{timeZoneName:t}).find((function(t){return "timezonename"===t.type.toLowerCase()}));return n&&n.value};var s=f.startOf;f.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return s.call(this,t,e);var n=o(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return s.call(n,t,e).tz(this.$x.$timezone,!0)},o.tz=function(t,e,n){var i=n&&e,a=n||e||r,f=u(+o(),a);if("string"!=typeof t)return o(t).tz(a);var s=function(t,e,n){var i=t-60*e*1e3,o=u(i,n);if(e===o)return [i,e];var r=u(i-=60*(o-e)*1e3,n);return o===r?[i,o]:[t-60*Math.min(o,r)*1e3,Math.max(o,r)]}(o.utc(t,i).valueOf(),f,a),m=s[0],c=s[1],d=o(m).utcOffset(c);return d.$x.$timezone=a,d},o.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},o.tz.setDefault=function(t){r=t;};}}));
71
+ }(timezone$1));
1872
72
 
1873
- /**
1874
- * @name format
1875
- * @category Common Helpers
1876
- * @summary Format the date.
1877
- *
1878
- * @description
1879
- * Return the formatted date string in the given format. The result may vary by locale.
1880
- *
1881
- * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1882
- * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
1883
- *
1884
- * The characters wrapped between two single quotes characters (') are escaped.
1885
- * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1886
- * (see the last example)
1887
- *
1888
- * Format of the string is based on Unicode Technical Standard #35:
1889
- * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1890
- * with a few additions (see note 7 below the table).
1891
- *
1892
- * Accepted patterns:
1893
- * | Unit | Pattern | Result examples | Notes |
1894
- * |---------------------------------|---------|-----------------------------------|-------|
1895
- * | Era | G..GGG | AD, BC | |
1896
- * | | GGGG | Anno Domini, Before Christ | 2 |
1897
- * | | GGGGG | A, B | |
1898
- * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
1899
- * | | yo | 44th, 1st, 0th, 17th | 5,7 |
1900
- * | | yy | 44, 01, 00, 17 | 5 |
1901
- * | | yyy | 044, 001, 1900, 2017 | 5 |
1902
- * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
1903
- * | | yyyyy | ... | 3,5 |
1904
- * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
1905
- * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
1906
- * | | YY | 44, 01, 00, 17 | 5,8 |
1907
- * | | YYY | 044, 001, 1900, 2017 | 5 |
1908
- * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
1909
- * | | YYYYY | ... | 3,5 |
1910
- * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
1911
- * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
1912
- * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
1913
- * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
1914
- * | | RRRRR | ... | 3,5,7 |
1915
- * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
1916
- * | | uu | -43, 01, 1900, 2017 | 5 |
1917
- * | | uuu | -043, 001, 1900, 2017 | 5 |
1918
- * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
1919
- * | | uuuuu | ... | 3,5 |
1920
- * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
1921
- * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
1922
- * | | QQ | 01, 02, 03, 04 | |
1923
- * | | QQQ | Q1, Q2, Q3, Q4 | |
1924
- * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
1925
- * | | QQQQQ | 1, 2, 3, 4 | 4 |
1926
- * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
1927
- * | | qo | 1st, 2nd, 3rd, 4th | 7 |
1928
- * | | qq | 01, 02, 03, 04 | |
1929
- * | | qqq | Q1, Q2, Q3, Q4 | |
1930
- * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
1931
- * | | qqqqq | 1, 2, 3, 4 | 4 |
1932
- * | Month (formatting) | M | 1, 2, ..., 12 | |
1933
- * | | Mo | 1st, 2nd, ..., 12th | 7 |
1934
- * | | MM | 01, 02, ..., 12 | |
1935
- * | | MMM | Jan, Feb, ..., Dec | |
1936
- * | | MMMM | January, February, ..., December | 2 |
1937
- * | | MMMMM | J, F, ..., D | |
1938
- * | Month (stand-alone) | L | 1, 2, ..., 12 | |
1939
- * | | Lo | 1st, 2nd, ..., 12th | 7 |
1940
- * | | LL | 01, 02, ..., 12 | |
1941
- * | | LLL | Jan, Feb, ..., Dec | |
1942
- * | | LLLL | January, February, ..., December | 2 |
1943
- * | | LLLLL | J, F, ..., D | |
1944
- * | Local week of year | w | 1, 2, ..., 53 | |
1945
- * | | wo | 1st, 2nd, ..., 53th | 7 |
1946
- * | | ww | 01, 02, ..., 53 | |
1947
- * | ISO week of year | I | 1, 2, ..., 53 | 7 |
1948
- * | | Io | 1st, 2nd, ..., 53th | 7 |
1949
- * | | II | 01, 02, ..., 53 | 7 |
1950
- * | Day of month | d | 1, 2, ..., 31 | |
1951
- * | | do | 1st, 2nd, ..., 31st | 7 |
1952
- * | | dd | 01, 02, ..., 31 | |
1953
- * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
1954
- * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
1955
- * | | DD | 01, 02, ..., 365, 366 | 9 |
1956
- * | | DDD | 001, 002, ..., 365, 366 | |
1957
- * | | DDDD | ... | 3 |
1958
- * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
1959
- * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
1960
- * | | EEEEE | M, T, W, T, F, S, S | |
1961
- * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
1962
- * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
1963
- * | | io | 1st, 2nd, ..., 7th | 7 |
1964
- * | | ii | 01, 02, ..., 07 | 7 |
1965
- * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
1966
- * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
1967
- * | | iiiii | M, T, W, T, F, S, S | 7 |
1968
- * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
1969
- * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
1970
- * | | eo | 2nd, 3rd, ..., 1st | 7 |
1971
- * | | ee | 02, 03, ..., 01 | |
1972
- * | | eee | Mon, Tue, Wed, ..., Sun | |
1973
- * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
1974
- * | | eeeee | M, T, W, T, F, S, S | |
1975
- * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
1976
- * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
1977
- * | | co | 2nd, 3rd, ..., 1st | 7 |
1978
- * | | cc | 02, 03, ..., 01 | |
1979
- * | | ccc | Mon, Tue, Wed, ..., Sun | |
1980
- * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
1981
- * | | ccccc | M, T, W, T, F, S, S | |
1982
- * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
1983
- * | AM, PM | a..aa | AM, PM | |
1984
- * | | aaa | am, pm | |
1985
- * | | aaaa | a.m., p.m. | 2 |
1986
- * | | aaaaa | a, p | |
1987
- * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
1988
- * | | bbb | am, pm, noon, midnight | |
1989
- * | | bbbb | a.m., p.m., noon, midnight | 2 |
1990
- * | | bbbbb | a, p, n, mi | |
1991
- * | Flexible day period | B..BBB | at night, in the morning, ... | |
1992
- * | | BBBB | at night, in the morning, ... | 2 |
1993
- * | | BBBBB | at night, in the morning, ... | |
1994
- * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
1995
- * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
1996
- * | | hh | 01, 02, ..., 11, 12 | |
1997
- * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
1998
- * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
1999
- * | | HH | 00, 01, 02, ..., 23 | |
2000
- * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2001
- * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2002
- * | | KK | 01, 02, ..., 11, 00 | |
2003
- * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2004
- * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2005
- * | | kk | 24, 01, 02, ..., 23 | |
2006
- * | Minute | m | 0, 1, ..., 59 | |
2007
- * | | mo | 0th, 1st, ..., 59th | 7 |
2008
- * | | mm | 00, 01, ..., 59 | |
2009
- * | Second | s | 0, 1, ..., 59 | |
2010
- * | | so | 0th, 1st, ..., 59th | 7 |
2011
- * | | ss | 00, 01, ..., 59 | |
2012
- * | Fraction of second | S | 0, 1, ..., 9 | |
2013
- * | | SS | 00, 01, ..., 99 | |
2014
- * | | SSS | 000, 001, ..., 999 | |
2015
- * | | SSSS | ... | 3 |
2016
- * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2017
- * | | XX | -0800, +0530, Z | |
2018
- * | | XXX | -08:00, +05:30, Z | |
2019
- * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2020
- * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2021
- * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2022
- * | | xx | -0800, +0530, +0000 | |
2023
- * | | xxx | -08:00, +05:30, +00:00 | 2 |
2024
- * | | xxxx | -0800, +0530, +0000, +123456 | |
2025
- * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2026
- * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2027
- * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2028
- * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2029
- * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2030
- * | Seconds timestamp | t | 512969520 | 7 |
2031
- * | | tt | ... | 3,7 |
2032
- * | Milliseconds timestamp | T | 512969520900 | 7 |
2033
- * | | TT | ... | 3,7 |
2034
- * | Long localized date | P | 04/29/1453 | 7 |
2035
- * | | PP | Apr 29, 1453 | 7 |
2036
- * | | PPP | April 29th, 1453 | 7 |
2037
- * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2038
- * | Long localized time | p | 12:00 AM | 7 |
2039
- * | | pp | 12:00:00 AM | 7 |
2040
- * | | ppp | 12:00:00 AM GMT+2 | 7 |
2041
- * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2042
- * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2043
- * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2044
- * | | PPPppp | April 29th, 1453 at ... | 7 |
2045
- * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2046
- * Notes:
2047
- * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2048
- * are the same as "stand-alone" units, but are different in some languages.
2049
- * "Formatting" units are declined according to the rules of the language
2050
- * in the context of a date. "Stand-alone" units are always nominative singular:
2051
- *
2052
- * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2053
- *
2054
- * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2055
- *
2056
- * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2057
- * the single quote characters (see below).
2058
- * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2059
- * the output will be the same as default pattern for this unit, usually
2060
- * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2061
- * are marked with "2" in the last column of the table.
2062
- *
2063
- * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2064
- *
2065
- * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2066
- *
2067
- * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2068
- *
2069
- * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2070
- *
2071
- * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2072
- *
2073
- * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2074
- * The output will be padded with zeros to match the length of the pattern.
2075
- *
2076
- * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2077
- *
2078
- * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2079
- * These tokens represent the shortest form of the quarter.
2080
- *
2081
- * 5. The main difference between `y` and `u` patterns are B.C. years:
2082
- *
2083
- * | Year | `y` | `u` |
2084
- * |------|-----|-----|
2085
- * | AC 1 | 1 | 1 |
2086
- * | BC 1 | 1 | 0 |
2087
- * | BC 2 | 2 | -1 |
2088
- *
2089
- * Also `yy` always returns the last two digits of a year,
2090
- * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2091
- *
2092
- * | Year | `yy` | `uu` |
2093
- * |------|------|------|
2094
- * | 1 | 01 | 01 |
2095
- * | 14 | 14 | 14 |
2096
- * | 376 | 76 | 376 |
2097
- * | 1453 | 53 | 1453 |
2098
- *
2099
- * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2100
- * except local week-numbering years are dependent on `options.weekStartsOn`
2101
- * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2102
- * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2103
- *
2104
- * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2105
- * so right now these tokens fall back to GMT timezones.
2106
- *
2107
- * 7. These patterns are not in the Unicode Technical Standard #35:
2108
- * - `i`: ISO day of week
2109
- * - `I`: ISO week of year
2110
- * - `R`: ISO week-numbering year
2111
- * - `t`: seconds timestamp
2112
- * - `T`: milliseconds timestamp
2113
- * - `o`: ordinal number modifier
2114
- * - `P`: long localized date
2115
- * - `p`: long localized time
2116
- *
2117
- * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2118
- * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2119
- *
2120
- * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2121
- * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2122
- *
2123
- * @param {Date|Number} date - the original date
2124
- * @param {String} format - the string of tokens
2125
- * @param {Object} [options] - an object with options.
2126
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2127
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2128
- * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2129
- * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2130
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2131
- * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2132
- * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2133
- * @returns {String} the formatted date string
2134
- * @throws {TypeError} 2 arguments required
2135
- * @throws {RangeError} `date` must not be Invalid Date
2136
- * @throws {RangeError} `options.locale` must contain `localize` property
2137
- * @throws {RangeError} `options.locale` must contain `formatLong` property
2138
- * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2139
- * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2140
- * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2141
- * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2142
- * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2143
- * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2144
- * @throws {RangeError} format string contains an unescaped latin alphabet character
2145
- *
2146
- * @example
2147
- * // Represent 11 February 2014 in middle-endian format:
2148
- * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2149
- * //=> '02/11/2014'
2150
- *
2151
- * @example
2152
- * // Represent 2 July 2014 in Esperanto:
2153
- * import { eoLocale } from 'date-fns/locale/eo'
2154
- * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2155
- * locale: eoLocale
2156
- * })
2157
- * //=> '2-a de julio 2014'
2158
- *
2159
- * @example
2160
- * // Escape string by single quote characters:
2161
- * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2162
- * //=> "3 o'clock"
2163
- */
2164
-
2165
- function format(dirtyDate, dirtyFormatStr, options) {
2166
- var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
2167
- requiredArgs(2, arguments);
2168
- var formatStr = String(dirtyFormatStr);
2169
- var defaultOptions = getDefaultOptions();
2170
- var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
2171
- var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
2172
-
2173
- // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2174
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2175
- throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2176
- }
2177
- var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
2178
-
2179
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2180
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2181
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2182
- }
2183
- if (!locale.localize) {
2184
- throw new RangeError('locale must contain localize property');
2185
- }
2186
- if (!locale.formatLong) {
2187
- throw new RangeError('locale must contain formatLong property');
2188
- }
2189
- var originalDate = toDate(dirtyDate);
2190
- if (!isValid(originalDate)) {
2191
- throw new RangeError('Invalid time value');
2192
- }
2193
-
2194
- // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2195
- // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2196
- // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2197
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2198
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
2199
- var formatterOptions = {
2200
- firstWeekContainsDate: firstWeekContainsDate,
2201
- weekStartsOn: weekStartsOn,
2202
- locale: locale,
2203
- _originalDate: originalDate
2204
- };
2205
- var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2206
- var firstCharacter = substring[0];
2207
- if (firstCharacter === 'p' || firstCharacter === 'P') {
2208
- var longFormatter = longFormatters$1[firstCharacter];
2209
- return longFormatter(substring, locale.formatLong);
2210
- }
2211
- return substring;
2212
- }).join('').match(formattingTokensRegExp).map(function (substring) {
2213
- // Replace two single quote characters with one single quote character
2214
- if (substring === "''") {
2215
- return "'";
2216
- }
2217
- var firstCharacter = substring[0];
2218
- if (firstCharacter === "'") {
2219
- return cleanEscapedString(substring);
2220
- }
2221
- var formatter = formatters$1[firstCharacter];
2222
- if (formatter) {
2223
- if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2224
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2225
- }
2226
- if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2227
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2228
- }
2229
- return formatter(utcDate, substring, locale.localize, formatterOptions);
2230
- }
2231
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2232
- throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2233
- }
2234
- return substring;
2235
- }).join('');
2236
- return result;
2237
- }
2238
- function cleanEscapedString(input) {
2239
- var matched = input.match(escapedStringRegExp);
2240
- if (!matched) {
2241
- return input;
2242
- }
2243
- return matched[1].replace(doubleQuoteRegExp, "'");
2244
- }
73
+ const timezone = timezone$1.exports;
2245
74
 
2246
75
  const customClockCss = ".CustomClockContainer.sc-custom-clock.sc-custom-clock{display:flex;justify-content:center;align-items:center}.CustomClockContainer.sc-custom-clock.sc-custom-clock p.sc-custom-clock{font-size:16px}";
2247
76
  const CustomClockStyle0 = customClockCss;
@@ -2251,10 +80,18 @@ const CustomClock = class {
2251
80
  index.registerInstance(this, hostRef);
2252
81
  this.startClock = () => {
2253
82
  this.intervalId = setInterval(() => {
2254
- this.timeString = format(new Date(), this.clockFormat);
83
+ if (this.timeZone.length > 0) {
84
+ dayjs.extend(utc);
85
+ dayjs.extend(timezone);
86
+ this.timeString = dayjs().tz(this.timeZone).format(this.clockFormat);
87
+ }
88
+ else {
89
+ this.timeString = dayjs().format(this.clockFormat);
90
+ }
2255
91
  }, 1000);
2256
92
  };
2257
- this.clockFormat = 'hh:MM a';
93
+ this.clockFormat = 'HH:mm:ss';
94
+ this.timeZone = '';
2258
95
  this.translationUrl = '';
2259
96
  this.language = 'en';
2260
97
  this.timeString = '';
@@ -2274,7 +111,7 @@ const CustomClock = class {
2274
111
  clearInterval(this.intervalId);
2275
112
  }
2276
113
  render() {
2277
- return (index.h("div", { key: '35cc9ba979bdc24b138d98d94f5a68139b126634', class: "CustomClockContainer" }, index.h("p", { key: '49654823c681d720bdb2beca7516395afadfe123' }, translate('currentTime', this.language), ": ", this.timeString)));
114
+ return (index.h("div", { key: 'a5f785406272352dfe1797105d524c042ff03b41', class: "CustomClockContainer" }, index.h("p", { key: '8e9ebfae2f06a4297af2f39210e8687bc6c141b4' }, translate('currentTime', this.language), ": ", this.timeString)));
2278
115
  }
2279
116
  static get watchers() { return {
2280
117
  "translationUrl": ["handleNewTranslations"]