date-and-time 2.4.1 → 2.4.3
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.
- package/README.md +9 -12
- package/date-and-time.js +2 -2
- package/date-and-time.min.js +4 -17
- package/esm/date-and-time.es.js +2 -2
- package/esm/date-and-time.es.min.js +4 -18
- package/esm/date-and-time.mjs +2 -2
- package/esm/plugin/timezone.es.js +1 -1
- package/esm/plugin/timezone.mjs +1 -1
- package/package.json +6 -6
- package/plugin/timezone.js +1 -1
- package/rollup.config.mjs +356 -0
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ Nowadays, JS modules have become huge, complex, and have many dependencies. We t
|
|
|
13
13
|
- Minimalist. Approximately 2k. (minified and gzipped)
|
|
14
14
|
- Extensible. Plugin system support.
|
|
15
15
|
- Multi language support.
|
|
16
|
-
- Universal / Isomorphic. Works
|
|
16
|
+
- Universal / Isomorphic. Works anywhere.
|
|
17
|
+
- TypeScript support.
|
|
17
18
|
- Older browser support. Even works on IE6. :)
|
|
18
19
|
|
|
19
20
|
## Install
|
|
@@ -24,18 +25,14 @@ npm i date-and-time
|
|
|
24
25
|
|
|
25
26
|
## Recent Changes
|
|
26
27
|
|
|
27
|
-
- 2.4.
|
|
28
|
-
- Fixed the
|
|
29
|
-
|
|
30
|
-
- 2.4.0
|
|
31
|
-
- Support for testing in Jest.
|
|
28
|
+
- 2.4.3
|
|
29
|
+
- Fixed an issue where using the `addMonths` function in regions with daylight saving time would return incorrect results.
|
|
32
30
|
|
|
33
|
-
- 2.
|
|
34
|
-
-
|
|
31
|
+
- 2.4.2
|
|
32
|
+
- Fixed an issue where the timezone plugin stopped working due to Node.js timezone update.
|
|
35
33
|
|
|
36
|
-
- 2.
|
|
37
|
-
-
|
|
38
|
-
- Fixed an issue where `parseTZ()` in timezone plugin could return `NaN` instead of `Invalid Date` if parsing failed.
|
|
34
|
+
- 2.4.1
|
|
35
|
+
- Fixed the previous Jest support.
|
|
39
36
|
|
|
40
37
|
## Usage
|
|
41
38
|
|
|
@@ -276,7 +273,7 @@ If the function fails to parse, it will return `Invalid Date`. Notice that the `
|
|
|
276
273
|
```javascript
|
|
277
274
|
const today = date.parse('Jam 1 2017', 'MMM D YYYY');
|
|
278
275
|
|
|
279
|
-
if (isNaN(today)) {
|
|
276
|
+
if (isNaN(today.getTime())) {
|
|
280
277
|
// Failure
|
|
281
278
|
}
|
|
282
279
|
```
|
package/date-and-time.js
CHANGED
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
proto.addMonths = function (dateObj, months) {
|
|
292
292
|
var d = new Date(dateObj.getTime());
|
|
293
293
|
|
|
294
|
-
d.
|
|
294
|
+
d.setUTCMonth(d.getUTCMonth() + months);
|
|
295
295
|
return d;
|
|
296
296
|
};
|
|
297
297
|
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
proto.addDays = function (dateObj, days) {
|
|
305
305
|
var d = new Date(dateObj.getTime());
|
|
306
306
|
|
|
307
|
-
d.
|
|
307
|
+
d.setUTCDate(d.getUTCDate() + days);
|
|
308
308
|
return d;
|
|
309
309
|
};
|
|
310
310
|
|
package/date-and-time.min.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ddd:"Sun Mon Tue Wed Thu Fri Sat".split(" "),dd:"Su Mo Tu We Th Fr Sa".split(" "),A:["AM","PM"]},w={YYYY:function(a){return("000"+a.getFullYear()).slice(-4)},YY:function(a){return("0"+a.getFullYear()).slice(-2)},Y:function(a){return""+a.getFullYear()},MMMM:function(a){return this.res.MMMM[a.getMonth()]},MMM:function(a){return this.res.MMM[a.getMonth()]},MM:function(a){return("0"+(a.getMonth()+1)).slice(-2)},M:function(a){return""+(a.getMonth()+1)},DD:function(a){return("0"+a.getDate()).slice(-2)},
|
|
6
|
-
D:function(a){return""+a.getDate()},HH:function(a){return("0"+a.getHours()).slice(-2)},H:function(a){return""+a.getHours()},A:function(a){return this.res.A[11<a.getHours()|0]},hh:function(a){return("0"+(a.getHours()%12||12)).slice(-2)},h:function(a){return""+(a.getHours()%12||12)},mm:function(a){return("0"+a.getMinutes()).slice(-2)},m:function(a){return""+a.getMinutes()},ss:function(a){return("0"+a.getSeconds()).slice(-2)},s:function(a){return""+a.getSeconds()},SSS:function(a){return("00"+a.getMilliseconds()).slice(-3)},
|
|
7
|
-
SS:function(a){return("0"+(a.getMilliseconds()/10|0)).slice(-2)},S:function(a){return""+(a.getMilliseconds()/100|0)},dddd:function(a){return this.res.dddd[a.getDay()]},ddd:function(a){return this.res.ddd[a.getDay()]},dd:function(a){return this.res.dd[a.getDay()]},Z:function(a){a=a.getTimezoneOffset()/.6|0;return(0<a?"-":"+")+("000"+Math.abs(a-(a%100*.4|0))).slice(-4)},ZZ:function(a){a=a.getTimezoneOffset();var b=Math.abs(a);return(0<a?"-":"+")+("0"+(b/60|0)).slice(-2)+":"+("0"+b%60).slice(-2)},post:function(a){return a},
|
|
8
|
-
res:t},x={YYYY:function(a){return this.exec(/^\d{4}/,a)},Y:function(a){return this.exec(/^\d{1,4}/,a)},MMMM:function(a){a=this.find(this.res.MMMM,a);a.value++;return a},MMM:function(a){a=this.find(this.res.MMM,a);a.value++;return a},MM:function(a){return this.exec(/^\d\d/,a)},M:function(a){return this.exec(/^\d\d?/,a)},DD:function(a){return this.exec(/^\d\d/,a)},D:function(a){return this.exec(/^\d\d?/,a)},HH:function(a){return this.exec(/^\d\d/,a)},H:function(a){return this.exec(/^\d\d?/,a)},A:function(a){return this.find(this.res.A,
|
|
9
|
-
a)},hh:function(a){return this.exec(/^\d\d/,a)},h:function(a){return this.exec(/^\d\d?/,a)},mm:function(a){return this.exec(/^\d\d/,a)},m:function(a){return this.exec(/^\d\d?/,a)},ss:function(a){return this.exec(/^\d\d/,a)},s:function(a){return this.exec(/^\d\d?/,a)},SSS:function(a){return this.exec(/^\d{1,3}/,a)},SS:function(a){a=this.exec(/^\d\d?/,a);a.value*=10;return a},S:function(a){a=this.exec(/^\d/,a);a.value*=100;return a},Z:function(a){a=this.exec(/^[\+-]\d{2}[0-5]\d/,a);a.value=-60*(a.value/
|
|
10
|
-
100|0)-a.value%100;return a},ZZ:function(a){a=/^([\+-])(\d{2}):([0-5]\d)/.exec(a)||["","","",""];return{value:-(60*(a[1]+a[2]|0)+(a[1]+a[3]|0)),length:a[0].length}},h12:function(a,b){return(12===a?0:a)+12*b},exec:function(a,b){a=(a.exec(b)||[""])[0];return{value:a|0,length:a.length}},find:function(a,b){for(var d=-1,c=0,h=0,g=a.length,l;h<g;h++)l=a[h],!b.indexOf(l)&&l.length>c&&(d=h,c=l.length);return{value:d,length:c}},pre:function(a){return a},res:t},n=function(a,b,d,c){var h={},g;for(g in a)h[g]=
|
|
11
|
-
a[g];for(g in b||{})!!d^!!h[g]||(h[g]=b[g]);c&&(h.res=c);return h},f={_formatter:w,_parser:x};f.compile=function(a){for(var b=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,d,c=[a];d=b.exec(a);)c[c.length]=d[0];return c};f.format=function(a,b,d){var c=this||e;b="string"===typeof b?c.compile(b):b;var h=a.getTimezoneOffset();a=c.addMinutes(a,d?h:0);c=c._formatter;var g="";a.getTimezoneOffset=function(){return d?0:h};for(var l=1,u=b.length,k;l<u;l++)k=b[l],g+=c[k]?c.post(c[k](a,b[0])):k.replace(/\[(.*)]/,
|
|
12
|
-
"$1");return g};f.preparse=function(a,b){var d=this||e;b="string"===typeof b?d.compile(b):b;var c={Y:1970,M:1,D:1,H:0,A:0,h:0,m:0,s:0,S:0,Z:0,_index:0,_length:0,_match:0},h=/\[(.*)]/;d=d._parser;var g=0;a=d.pre(a);for(var l=1,u=b.length,k,q;l<u;l++)if(k=b[l],d[k]){q=d[k](a.slice(g),b[0]);if(!q.length)break;g+=q.length;c[q.token||k.charAt(0)]=q.value;c._match++}else if(k===a.charAt(g)||" "===k)g++;else if(h.test(k)&&!a.slice(g).indexOf(h.exec(k)[1]))g+=k.length-2;else{"..."===k&&(g=a.length);break}c.H=
|
|
13
|
-
c.H||d.h12(c.h,c.A);c._index=g;c._length=a.length;return c};f.parse=function(a,b,d){var c=this||e;b="string"===typeof b?c.compile(b):b;a=c.preparse(a,b);return c.isValid(a)?(a.M-=100>a.Y?22801:1,d||~c._parser.find(b,"ZZ").value?new Date(Date.UTC(a.Y,a.M,a.D,a.H,a.m+a.Z,a.s,a.S)):new Date(a.Y,a.M,a.D,a.H,a.m,a.s,a.S)):new Date(NaN)};f.isValid=function(a,b){var d=this||e;a="string"===typeof a?d.preparse(a,b):a;d=[31,28+d.isLeapYear(a.Y)|0,31,30,31,30,31,31,30,31,30,31][a.M-1];return!(1>a._index||1>
|
|
14
|
-
a._length||a._index-a._length||1>a._match||1>a.Y||9999<a.Y||1>a.M||12<a.M||1>a.D||a.D>d||0>a.H||23<a.H||0>a.m||59<a.m||0>a.s||59<a.s||0>a.S||999<a.S||-840>a.Z||720<a.Z)};f.transform=function(a,b,d,c){let h=this||e;return h.format(h.parse(a,b),d,c)};f.addYears=function(a,b){return(this||e).addMonths(a,12*b)};f.addMonths=function(a,b){a=new Date(a.getTime());a.setMonth(a.getMonth()+b);return a};f.addDays=function(a,b){a=new Date(a.getTime());a.setDate(a.getDate()+b);return a};f.addHours=function(a,
|
|
15
|
-
b){return(this||e).addMinutes(a,60*b)};f.addMinutes=function(a,b){return(this||e).addSeconds(a,60*b)};f.addSeconds=function(a,b){return(this||e).addMilliseconds(a,1E3*b)};f.addMilliseconds=function(a,b){return new Date(a.getTime()+b)};f.subtract=function(a,b){var d=a.getTime()-b.getTime();return{toMilliseconds:function(){return d},toSeconds:function(){return d/1E3},toMinutes:function(){return d/6E4},toHours:function(){return d/36E5},toDays:function(){return d/864E5}}};f.isLeapYear=function(a){return!(a%
|
|
16
|
-
4)&&!!(a%100)||!(a%400)};f.isSameDay=function(a,b){return a.toDateString()===b.toDateString()};f.locale=function(a,b){p[a]||(p[a]=b)};f.plugin=function(a,b){m[a]||(m[a]=b)};var v=n(f);var e=n(f);e.locale=function(a){a="function"===typeof a?a:e.locale[a];if(!a)return r;r=a(f);var b=p[r]||{},d=n(t,b.res,!0);a=n(w,b.formatter,!0,d);b=n(x,b.parser,!0,d);e._formatter=v._formatter=a;e._parser=v._parser=b;for(var c in m)e.extend(m[c]);return r};e.extend=function(a){var b=n(e._parser.res,a.res),d=a.extender||
|
|
17
|
-
{};e._formatter=n(e._formatter,a.formatter,!1,b);e._parser=n(e._parser,a.parser,!1,b);for(var c in d)e[c]||(e[c]=d[c])};e.plugin=function(a){(a="function"===typeof a?a:e.plugin[a])&&e.extend(m[a(f,v)]||{})};return e})
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).date=t()}(this,(function(){"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @preserve date-and-time (c) KNOWLEDGECODE | MIT
|
|
4
|
+
*/var e,t,n={},r={},i="en",u={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"]},o={YYYY:function(e){return("000"+e.getFullYear()).slice(-4)},YY:function(e){return("0"+e.getFullYear()).slice(-2)},Y:function(e){return""+e.getFullYear()},MMMM:function(e){return this.res.MMMM[e.getMonth()]},MMM:function(e){return this.res.MMM[e.getMonth()]},MM:function(e){return("0"+(e.getMonth()+1)).slice(-2)},M:function(e){return""+(e.getMonth()+1)},DD:function(e){return("0"+e.getDate()).slice(-2)},D:function(e){return""+e.getDate()},HH:function(e){return("0"+e.getHours()).slice(-2)},H:function(e){return""+e.getHours()},A:function(e){return this.res.A[e.getHours()>11|0]},hh:function(e){return("0"+(e.getHours()%12||12)).slice(-2)},h:function(e){return""+(e.getHours()%12||12)},mm:function(e){return("0"+e.getMinutes()).slice(-2)},m:function(e){return""+e.getMinutes()},ss:function(e){return("0"+e.getSeconds()).slice(-2)},s:function(e){return""+e.getSeconds()},SSS:function(e){return("00"+e.getMilliseconds()).slice(-3)},SS:function(e){return("0"+(e.getMilliseconds()/10|0)).slice(-2)},S:function(e){return""+(e.getMilliseconds()/100|0)},dddd:function(e){return this.res.dddd[e.getDay()]},ddd:function(e){return this.res.ddd[e.getDay()]},dd:function(e){return this.res.dd[e.getDay()]},Z:function(e){var t=e.getTimezoneOffset()/.6|0;return(t>0?"-":"+")+("000"+Math.abs(t-(t%100*.4|0))).slice(-4)},ZZ:function(e){var t=e.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+("0"+(n/60|0)).slice(-2)+":"+("0"+n%60).slice(-2)},post:function(e){return e},res:u},s={YYYY:function(e){return this.exec(/^\d{4}/,e)},Y:function(e){return this.exec(/^\d{1,4}/,e)},MMMM:function(e){var t=this.find(this.res.MMMM,e);return t.value++,t},MMM:function(e){var t=this.find(this.res.MMM,e);return t.value++,t},MM:function(e){return this.exec(/^\d\d/,e)},M:function(e){return this.exec(/^\d\d?/,e)},DD:function(e){return this.exec(/^\d\d/,e)},D:function(e){return this.exec(/^\d\d?/,e)},HH:function(e){return this.exec(/^\d\d/,e)},H:function(e){return this.exec(/^\d\d?/,e)},A:function(e){return this.find(this.res.A,e)},hh:function(e){return this.exec(/^\d\d/,e)},h:function(e){return this.exec(/^\d\d?/,e)},mm:function(e){return this.exec(/^\d\d/,e)},m:function(e){return this.exec(/^\d\d?/,e)},ss:function(e){return this.exec(/^\d\d/,e)},s:function(e){return this.exec(/^\d\d?/,e)},SSS:function(e){return this.exec(/^\d{1,3}/,e)},SS:function(e){var t=this.exec(/^\d\d?/,e);return t.value*=10,t},S:function(e){var t=this.exec(/^\d/,e);return t.value*=100,t},Z:function(e){var t=this.exec(/^[\+-]\d{2}[0-5]\d/,e);return t.value=-60*(t.value/100|0)-t.value%100,t},ZZ:function(e){var t=/^([\+-])(\d{2}):([0-5]\d)/.exec(e)||["","","",""];return{value:0-(60*(t[1]+t[2]|0)+(t[1]+t[3]|0)),length:t[0].length}},h12:function(e,t){return(12===e?0:e)+12*t},exec:function(e,t){var n=(e.exec(t)||[""])[0];return{value:0|n,length:n.length}},find:function(e,t){for(var n,r=-1,i=0,u=0,o=e.length;u<o;u++)n=e[u],!t.indexOf(n)&&n.length>i&&(r=u,i=n.length);return{value:r,length:i}},pre:function(e){return e},res:u},c=function(e,t,n,r){var i,u={};for(i in e)u[i]=e[i];for(i in t||{})!!n^!!u[i]||(u[i]=t[i]);return r&&(u.res=r),u},a={_formatter:o,_parser:s};return a.compile=function(e){for(var t,n=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,r=[e];t=n.exec(e);)r[r.length]=t[0];return r},a.format=function(e,n,r){var i=this||t,u="string"==typeof n?i.compile(n):n,o=e.getTimezoneOffset(),s=i.addMinutes(e,r?o:0),c=i._formatter,a="";s.getTimezoneOffset=function(){return r?0:o};for(var f,d=1,l=u.length;d<l;d++)a+=c[f=u[d]]?c.post(c[f](s,u[0])):f.replace(/\[(.*)]/,"$1");return a},a.preparse=function(e,n){var r=this||t,i="string"==typeof n?r.compile(n):n,u={Y:1970,M:1,D:1,H:0,A:0,h:0,m:0,s:0,S:0,Z:0,_index:0,_length:0,_match:0},o=/\[(.*)]/,s=r._parser,c=0;e=s.pre(e);for(var a,f,d=1,l=i.length;d<l;d++)if(s[a=i[d]]){if(!(f=s[a](e.slice(c),i[0])).length)break;c+=f.length,u[f.token||a.charAt(0)]=f.value,u._match++}else if(a===e.charAt(c)||" "===a)c++;else{if(!o.test(a)||e.slice(c).indexOf(o.exec(a)[1])){if("..."===a){c=e.length;break}break}c+=a.length-2}return u.H=u.H||s.h12(u.h,u.A),u._index=c,u._length=e.length,u},a.parse=function(e,n,r){var i=this||t,u="string"==typeof n?i.compile(n):n,o=i.preparse(e,u);return i.isValid(o)?(o.M-=o.Y<100?22801:1,r||~i._parser.find(u,"ZZ").value?new Date(Date.UTC(o.Y,o.M,o.D,o.H,o.m+o.Z,o.s,o.S)):new Date(o.Y,o.M,o.D,o.H,o.m,o.s,o.S)):new Date(NaN)},a.isValid=function(e,n){var r=this||t,i="string"==typeof e?r.preparse(e,n):e,u=[31,28+r.isLeapYear(i.Y)|0,31,30,31,30,31,31,30,31,30,31][i.M-1];return!(i._index<1||i._length<1||i._index-i._length||i._match<1||i.Y<1||i.Y>9999||i.M<1||i.M>12||i.D<1||i.D>u||i.H<0||i.H>23||i.m<0||i.m>59||i.s<0||i.s>59||i.S<0||i.S>999||i.Z<-840||i.Z>720)},a.transform=function(e,n,r,i){const u=this||t;return u.format(u.parse(e,n),r,i)},a.addYears=function(e,n){return(this||t).addMonths(e,12*n)},a.addMonths=function(e,t){var n=new Date(e.getTime());return n.setUTCMonth(n.getUTCMonth()+t),n},a.addDays=function(e,t){var n=new Date(e.getTime());return n.setUTCDate(n.getUTCDate()+t),n},a.addHours=function(e,n){return(this||t).addMinutes(e,60*n)},a.addMinutes=function(e,n){return(this||t).addSeconds(e,60*n)},a.addSeconds=function(e,n){return(this||t).addMilliseconds(e,1e3*n)},a.addMilliseconds=function(e,t){return new Date(e.getTime()+t)},a.subtract=function(e,t){var n=e.getTime()-t.getTime();return{toMilliseconds:function(){return n},toSeconds:function(){return n/1e3},toMinutes:function(){return n/6e4},toHours:function(){return n/36e5},toDays:function(){return n/864e5}}},a.isLeapYear=function(e){return!((e%4||!(e%100))&&e%400)},a.isSameDay=function(e,t){return e.toDateString()===t.toDateString()},a.locale=function(e,t){n[e]||(n[e]=t)},a.plugin=function(e,t){r[e]||(r[e]=t)},e=c(a),(t=c(a)).locale=function(f){var d="function"==typeof f?f:t.locale[f];if(!d)return i;i=d(a);var l=n[i]||{},h=c(u,l.res,!0),M=c(o,l.formatter,!0,h),g=c(s,l.parser,!0,h);for(var p in t._formatter=e._formatter=M,t._parser=e._parser=g,r)t.extend(r[p]);return i},t.extend=function(e){var n=c(t._parser.res,e.res),r=e.extender||{};for(var i in t._formatter=c(t._formatter,e.formatter,!1,n),t._parser=c(t._parser,e.parser,!1,n),r)t[i]||(t[i]=r[i])},t.plugin=function(n){var i="function"==typeof n?n:t.plugin[n];i&&t.extend(r[i(a,e)]||{})},t}));
|
package/esm/date-and-time.es.js
CHANGED
|
@@ -285,7 +285,7 @@ proto.addYears = function (dateObj, years) {
|
|
|
285
285
|
proto.addMonths = function (dateObj, months) {
|
|
286
286
|
var d = new Date(dateObj.getTime());
|
|
287
287
|
|
|
288
|
-
d.
|
|
288
|
+
d.setUTCMonth(d.getUTCMonth() + months);
|
|
289
289
|
return d;
|
|
290
290
|
};
|
|
291
291
|
|
|
@@ -298,7 +298,7 @@ proto.addMonths = function (dateObj, months) {
|
|
|
298
298
|
proto.addDays = function (dateObj, days) {
|
|
299
299
|
var d = new Date(dateObj.getTime());
|
|
300
300
|
|
|
301
|
-
d.
|
|
301
|
+
d.setUTCDate(d.getUTCDate() + days);
|
|
302
302
|
return d;
|
|
303
303
|
};
|
|
304
304
|
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
date-and-time (c) KNOWLEDGECODE | MIT
|
|
3
|
-
*/
|
|
4
|
-
var e={},
|
|
5
|
-
a.getFullYear()},MMMM:function(a){return this.res.MMMM[a.getMonth()]},MMM:function(a){return this.res.MMM[a.getMonth()]},MM:function(a){return("0"+(a.getMonth()+1)).slice(-2)},M:function(a){return""+(a.getMonth()+1)},DD:function(a){return("0"+a.getDate()).slice(-2)},D:function(a){return""+a.getDate()},HH:function(a){return("0"+a.getHours()).slice(-2)},H:function(a){return""+a.getHours()},A:function(a){return this.res.A[11<a.getHours()|0]},hh:function(a){return("0"+(a.getHours()%12||12)).slice(-2)},
|
|
6
|
-
h:function(a){return""+(a.getHours()%12||12)},mm:function(a){return("0"+a.getMinutes()).slice(-2)},m:function(a){return""+a.getMinutes()},ss:function(a){return("0"+a.getSeconds()).slice(-2)},s:function(a){return""+a.getSeconds()},SSS:function(a){return("00"+a.getMilliseconds()).slice(-3)},SS:function(a){return("0"+(a.getMilliseconds()/10|0)).slice(-2)},S:function(a){return""+(a.getMilliseconds()/100|0)},dddd:function(a){return this.res.dddd[a.getDay()]},ddd:function(a){return this.res.ddd[a.getDay()]},
|
|
7
|
-
dd:function(a){return this.res.dd[a.getDay()]},Z:function(a){a=a.getTimezoneOffset()/.6|0;return(0<a?"-":"+")+("000"+Math.abs(a-(a%100*.4|0))).slice(-4)},ZZ:function(a){a=a.getTimezoneOffset();var b=Math.abs(a);return(0<a?"-":"+")+("0"+(b/60|0)).slice(-2)+":"+("0"+b%60).slice(-2)},post:function(a){return a},res:n},r={YYYY:function(a){return this.exec(/^\d{4}/,a)},Y:function(a){return this.exec(/^\d{1,4}/,a)},MMMM:function(a){a=this.find(this.res.MMMM,a);a.value++;return a},MMM:function(a){a=this.find(this.res.MMM,
|
|
8
|
-
a);a.value++;return a},MM:function(a){return this.exec(/^\d\d/,a)},M:function(a){return this.exec(/^\d\d?/,a)},DD:function(a){return this.exec(/^\d\d/,a)},D:function(a){return this.exec(/^\d\d?/,a)},HH:function(a){return this.exec(/^\d\d/,a)},H:function(a){return this.exec(/^\d\d?/,a)},A:function(a){return this.find(this.res.A,a)},hh:function(a){return this.exec(/^\d\d/,a)},h:function(a){return this.exec(/^\d\d?/,a)},mm:function(a){return this.exec(/^\d\d/,a)},m:function(a){return this.exec(/^\d\d?/,
|
|
9
|
-
a)},ss:function(a){return this.exec(/^\d\d/,a)},s:function(a){return this.exec(/^\d\d?/,a)},SSS:function(a){return this.exec(/^\d{1,3}/,a)},SS:function(a){a=this.exec(/^\d\d?/,a);a.value*=10;return a},S:function(a){a=this.exec(/^\d/,a);a.value*=100;return a},Z:function(a){a=this.exec(/^[\+-]\d{2}[0-5]\d/,a);a.value=-60*(a.value/100|0)-a.value%100;return a},ZZ:function(a){a=/^([\+-])(\d{2}):([0-5]\d)/.exec(a)||["","","",""];return{value:-(60*(a[1]+a[2]|0)+(a[1]+a[3]|0)),length:a[0].length}},h12:function(a,
|
|
10
|
-
b){return(12===a?0:a)+12*b},exec:function(a,b){a=(a.exec(b)||[""])[0];return{value:a|0,length:a.length}},find:function(a,b){for(var d=-1,c=0,h=0,g=a.length,l;h<g;h++)l=a[h],!b.indexOf(l)&&l.length>c&&(d=h,c=l.length);return{value:d,length:c}},pre:function(a){return a},res:n};function t(a,b,d,c){var h={},g;for(g in a)h[g]=a[g];for(g in b||{})!!d^!!h[g]||(h[g]=b[g]);c&&(h.res=c);return h}var u={_formatter:q,_parser:r},w,x;
|
|
11
|
-
u.compile=function(a){for(var b=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,d,c=[a];d=b.exec(a);)c[c.length]=d[0];return c};u.format=function(a,b,d){var c=this||x;b="string"===typeof b?c.compile(b):b;var h=a.getTimezoneOffset();a=c.addMinutes(a,d?h:0);c=c._formatter;var g="";a.getTimezoneOffset=function(){return d?0:h};for(var l=1,v=b.length,k;l<v;l++)k=b[l],g+=c[k]?c.post(c[k](a,b[0])):k.replace(/\[(.*)]/,"$1");return g};
|
|
12
|
-
u.preparse=function(a,b){var d=this||x;b="string"===typeof b?d.compile(b):b;var c={Y:1970,M:1,D:1,H:0,A:0,h:0,m:0,s:0,S:0,Z:0,_index:0,_length:0,_match:0},h=/\[(.*)]/;d=d._parser;var g=0;a=d.pre(a);for(var l=1,v=b.length,k,p;l<v;l++)if(k=b[l],d[k]){p=d[k](a.slice(g),b[0]);if(!p.length)break;g+=p.length;c[p.token||k.charAt(0)]=p.value;c._match++}else if(k===a.charAt(g)||" "===k)g++;else if(h.test(k)&&!a.slice(g).indexOf(h.exec(k)[1]))g+=k.length-2;else{"..."===k&&(g=a.length);break}c.H=c.H||d.h12(c.h,
|
|
13
|
-
c.A);c._index=g;c._length=a.length;return c};u.parse=function(a,b,d){var c=this||x;b="string"===typeof b?c.compile(b):b;a=c.preparse(a,b);return c.isValid(a)?(a.M-=100>a.Y?22801:1,d||~c._parser.find(b,"ZZ").value?new Date(Date.UTC(a.Y,a.M,a.D,a.H,a.m+a.Z,a.s,a.S)):new Date(a.Y,a.M,a.D,a.H,a.m,a.s,a.S)):new Date(NaN)};
|
|
14
|
-
u.isValid=function(a,b){var d=this||x;a="string"===typeof a?d.preparse(a,b):a;d=[31,28+d.isLeapYear(a.Y)|0,31,30,31,30,31,31,30,31,30,31][a.M-1];return!(1>a._index||1>a._length||a._index-a._length||1>a._match||1>a.Y||9999<a.Y||1>a.M||12<a.M||1>a.D||a.D>d||0>a.H||23<a.H||0>a.m||59<a.m||0>a.s||59<a.s||0>a.S||999<a.S||-840>a.Z||720<a.Z)};u.transform=function(a,b,d,c){let h=this||x;return h.format(h.parse(a,b),d,c)};u.addYears=function(a,b){return(this||x).addMonths(a,12*b)};
|
|
15
|
-
u.addMonths=function(a,b){a=new Date(a.getTime());a.setMonth(a.getMonth()+b);return a};u.addDays=function(a,b){a=new Date(a.getTime());a.setDate(a.getDate()+b);return a};u.addHours=function(a,b){return(this||x).addMinutes(a,60*b)};u.addMinutes=function(a,b){return(this||x).addSeconds(a,60*b)};u.addSeconds=function(a,b){return(this||x).addMilliseconds(a,1E3*b)};u.addMilliseconds=function(a,b){return new Date(a.getTime()+b)};
|
|
16
|
-
u.subtract=function(a,b){var d=a.getTime()-b.getTime();return{toMilliseconds:function(){return d},toSeconds:function(){return d/1E3},toMinutes:function(){return d/6E4},toHours:function(){return d/36E5},toDays:function(){return d/864E5}}};u.isLeapYear=function(a){return!(a%4)&&!!(a%100)||!(a%400)};u.isSameDay=function(a,b){return a.toDateString()===b.toDateString()};u.locale=function(a,b){e[a]||(e[a]=b)};u.plugin=function(a,b){f[a]||(f[a]=b)};w=t(u);x=t(u);
|
|
17
|
-
x.locale=function(a){a="function"===typeof a?a:x.locale[a];if(!a)return m;m=a(u);var b=e[m]||{},d=t(n,b.res,!0);a=t(q,b.formatter,!0,d);b=t(r,b.parser,!0,d);x._formatter=w._formatter=a;x._parser=w._parser=b;for(var c in f)x.extend(f[c]);return m};x.extend=function(a){var b=t(x._parser.res,a.res),d=a.extender||{};x._formatter=t(x._formatter,a.formatter,!1,b);x._parser=t(x._parser,a.parser,!1,b);for(var c in d)x[c]||(x[c]=d[c])};
|
|
18
|
-
x.plugin=function(a){(a="function"===typeof a?a:x.plugin[a])&&x.extend(f[a(u,w)]||{})};export default x
|
|
1
|
+
/**
|
|
2
|
+
* @preserve date-and-time (c) KNOWLEDGECODE | MIT
|
|
3
|
+
*/
|
|
4
|
+
var e,t,n={},r={},u="en",i={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"]},o={YYYY:function(e){return("000"+e.getFullYear()).slice(-4)},YY:function(e){return("0"+e.getFullYear()).slice(-2)},Y:function(e){return""+e.getFullYear()},MMMM:function(e){return this.res.MMMM[e.getMonth()]},MMM:function(e){return this.res.MMM[e.getMonth()]},MM:function(e){return("0"+(e.getMonth()+1)).slice(-2)},M:function(e){return""+(e.getMonth()+1)},DD:function(e){return("0"+e.getDate()).slice(-2)},D:function(e){return""+e.getDate()},HH:function(e){return("0"+e.getHours()).slice(-2)},H:function(e){return""+e.getHours()},A:function(e){return this.res.A[e.getHours()>11|0]},hh:function(e){return("0"+(e.getHours()%12||12)).slice(-2)},h:function(e){return""+(e.getHours()%12||12)},mm:function(e){return("0"+e.getMinutes()).slice(-2)},m:function(e){return""+e.getMinutes()},ss:function(e){return("0"+e.getSeconds()).slice(-2)},s:function(e){return""+e.getSeconds()},SSS:function(e){return("00"+e.getMilliseconds()).slice(-3)},SS:function(e){return("0"+(e.getMilliseconds()/10|0)).slice(-2)},S:function(e){return""+(e.getMilliseconds()/100|0)},dddd:function(e){return this.res.dddd[e.getDay()]},ddd:function(e){return this.res.ddd[e.getDay()]},dd:function(e){return this.res.dd[e.getDay()]},Z:function(e){var t=e.getTimezoneOffset()/.6|0;return(t>0?"-":"+")+("000"+Math.abs(t-(t%100*.4|0))).slice(-4)},ZZ:function(e){var t=e.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+("0"+(n/60|0)).slice(-2)+":"+("0"+n%60).slice(-2)},post:function(e){return e},res:i},s={YYYY:function(e){return this.exec(/^\d{4}/,e)},Y:function(e){return this.exec(/^\d{1,4}/,e)},MMMM:function(e){var t=this.find(this.res.MMMM,e);return t.value++,t},MMM:function(e){var t=this.find(this.res.MMM,e);return t.value++,t},MM:function(e){return this.exec(/^\d\d/,e)},M:function(e){return this.exec(/^\d\d?/,e)},DD:function(e){return this.exec(/^\d\d/,e)},D:function(e){return this.exec(/^\d\d?/,e)},HH:function(e){return this.exec(/^\d\d/,e)},H:function(e){return this.exec(/^\d\d?/,e)},A:function(e){return this.find(this.res.A,e)},hh:function(e){return this.exec(/^\d\d/,e)},h:function(e){return this.exec(/^\d\d?/,e)},mm:function(e){return this.exec(/^\d\d/,e)},m:function(e){return this.exec(/^\d\d?/,e)},ss:function(e){return this.exec(/^\d\d/,e)},s:function(e){return this.exec(/^\d\d?/,e)},SSS:function(e){return this.exec(/^\d{1,3}/,e)},SS:function(e){var t=this.exec(/^\d\d?/,e);return t.value*=10,t},S:function(e){var t=this.exec(/^\d/,e);return t.value*=100,t},Z:function(e){var t=this.exec(/^[\+-]\d{2}[0-5]\d/,e);return t.value=-60*(t.value/100|0)-t.value%100,t},ZZ:function(e){var t=/^([\+-])(\d{2}):([0-5]\d)/.exec(e)||["","","",""];return{value:0-(60*(t[1]+t[2]|0)+(t[1]+t[3]|0)),length:t[0].length}},h12:function(e,t){return(12===e?0:e)+12*t},exec:function(e,t){var n=(e.exec(t)||[""])[0];return{value:0|n,length:n.length}},find:function(e,t){for(var n,r=-1,u=0,i=0,o=e.length;i<o;i++)n=e[i],!t.indexOf(n)&&n.length>u&&(r=i,u=n.length);return{value:r,length:u}},pre:function(e){return e},res:i},c=function(e,t,n,r){var u,i={};for(u in e)i[u]=e[u];for(u in t||{})!!n^!!i[u]||(i[u]=t[u]);return r&&(i.res=r),i},a={_formatter:o,_parser:s};a.compile=function(e){for(var t,n=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,r=[e];t=n.exec(e);)r[r.length]=t[0];return r},a.format=function(e,n,r){var u=this||t,i="string"==typeof n?u.compile(n):n,o=e.getTimezoneOffset(),s=u.addMinutes(e,r?o:0),c=u._formatter,a="";s.getTimezoneOffset=function(){return r?0:o};for(var f,d=1,h=i.length;d<h;d++)a+=c[f=i[d]]?c.post(c[f](s,i[0])):f.replace(/\[(.*)]/,"$1");return a},a.preparse=function(e,n){var r=this||t,u="string"==typeof n?r.compile(n):n,i={Y:1970,M:1,D:1,H:0,A:0,h:0,m:0,s:0,S:0,Z:0,_index:0,_length:0,_match:0},o=/\[(.*)]/,s=r._parser,c=0;e=s.pre(e);for(var a,f,d=1,h=u.length;d<h;d++)if(s[a=u[d]]){if(!(f=s[a](e.slice(c),u[0])).length)break;c+=f.length,i[f.token||a.charAt(0)]=f.value,i._match++}else if(a===e.charAt(c)||" "===a)c++;else{if(!o.test(a)||e.slice(c).indexOf(o.exec(a)[1])){if("..."===a){c=e.length;break}break}c+=a.length-2}return i.H=i.H||s.h12(i.h,i.A),i._index=c,i._length=e.length,i},a.parse=function(e,n,r){var u=this||t,i="string"==typeof n?u.compile(n):n,o=u.preparse(e,i);return u.isValid(o)?(o.M-=o.Y<100?22801:1,r||~u._parser.find(i,"ZZ").value?new Date(Date.UTC(o.Y,o.M,o.D,o.H,o.m+o.Z,o.s,o.S)):new Date(o.Y,o.M,o.D,o.H,o.m,o.s,o.S)):new Date(NaN)},a.isValid=function(e,n){var r=this||t,u="string"==typeof e?r.preparse(e,n):e,i=[31,28+r.isLeapYear(u.Y)|0,31,30,31,30,31,31,30,31,30,31][u.M-1];return!(u._index<1||u._length<1||u._index-u._length||u._match<1||u.Y<1||u.Y>9999||u.M<1||u.M>12||u.D<1||u.D>i||u.H<0||u.H>23||u.m<0||u.m>59||u.s<0||u.s>59||u.S<0||u.S>999||u.Z<-840||u.Z>720)},a.transform=function(e,n,r,u){const i=this||t;return i.format(i.parse(e,n),r,u)},a.addYears=function(e,n){return(this||t).addMonths(e,12*n)},a.addMonths=function(e,t){var n=new Date(e.getTime());return n.setUTCMonth(n.getUTCMonth()+t),n},a.addDays=function(e,t){var n=new Date(e.getTime());return n.setUTCDate(n.getUTCDate()+t),n},a.addHours=function(e,n){return(this||t).addMinutes(e,60*n)},a.addMinutes=function(e,n){return(this||t).addSeconds(e,60*n)},a.addSeconds=function(e,n){return(this||t).addMilliseconds(e,1e3*n)},a.addMilliseconds=function(e,t){return new Date(e.getTime()+t)},a.subtract=function(e,t){var n=e.getTime()-t.getTime();return{toMilliseconds:function(){return n},toSeconds:function(){return n/1e3},toMinutes:function(){return n/6e4},toHours:function(){return n/36e5},toDays:function(){return n/864e5}}},a.isLeapYear=function(e){return!((e%4||!(e%100))&&e%400)},a.isSameDay=function(e,t){return e.toDateString()===t.toDateString()},a.locale=function(e,t){n[e]||(n[e]=t)},a.plugin=function(e,t){r[e]||(r[e]=t)},e=c(a),(t=c(a)).locale=function(f){var d="function"==typeof f?f:t.locale[f];if(!d)return u;u=d(a);var h=n[u]||{},l=c(i,h.res,!0),M=c(o,h.formatter,!0,l),g=c(s,h.parser,!0,l);for(var p in t._formatter=e._formatter=M,t._parser=e._parser=g,r)t.extend(r[p]);return u},t.extend=function(e){var n=c(t._parser.res,e.res),r=e.extender||{};for(var u in t._formatter=c(t._formatter,e.formatter,!1,n),t._parser=c(t._parser,e.parser,!1,n),r)t[u]||(t[u]=r[u])},t.plugin=function(n){var u="function"==typeof n?n:t.plugin[n];u&&t.extend(r[u(a,e)]||{})};var f=t;export{f as default};
|
package/esm/date-and-time.mjs
CHANGED
|
@@ -285,7 +285,7 @@ proto.addYears = function (dateObj, years) {
|
|
|
285
285
|
proto.addMonths = function (dateObj, months) {
|
|
286
286
|
var d = new Date(dateObj.getTime());
|
|
287
287
|
|
|
288
|
-
d.
|
|
288
|
+
d.setUTCMonth(d.getUTCMonth() + months);
|
|
289
289
|
return d;
|
|
290
290
|
};
|
|
291
291
|
|
|
@@ -298,7 +298,7 @@ proto.addMonths = function (dateObj, months) {
|
|
|
298
298
|
proto.addDays = function (dateObj, days) {
|
|
299
299
|
var d = new Date(dateObj.getTime());
|
|
300
300
|
|
|
301
|
-
d.
|
|
301
|
+
d.setUTCDate(d.getUTCDate() + days);
|
|
302
302
|
return d;
|
|
303
303
|
};
|
|
304
304
|
|
|
@@ -44,7 +44,7 @@ var plugin = function (date, localized_date) {
|
|
|
44
44
|
var dateString2 = date.format(localized_date.parse(dateString, pattern2), pattern);
|
|
45
45
|
|
|
46
46
|
var comparer = function (d) {
|
|
47
|
-
return dateString2 === dateTimeFormat.format(d);
|
|
47
|
+
return dateString2 === dateTimeFormat.format(d).replace(/[\u202f]/, ' ');
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// Trying to adjust for daylight saving time.
|
package/esm/plugin/timezone.mjs
CHANGED
|
@@ -44,7 +44,7 @@ var plugin = function (date, localized_date) {
|
|
|
44
44
|
var dateString2 = date.format(localized_date.parse(dateString, pattern2), pattern);
|
|
45
45
|
|
|
46
46
|
var comparer = function (d) {
|
|
47
|
-
return dateString2 === dateTimeFormat.format(d);
|
|
47
|
+
return dateString2 === dateTimeFormat.format(d).replace(/[\u202f]/, ' ');
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// Trying to adjust for daylight saving time.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "date-and-time",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "A Minimalist DateTime utility for Node.js and the browser",
|
|
5
5
|
"main": "date-and-time.js",
|
|
6
6
|
"module": "esm/date-and-time.es.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "rollup
|
|
27
|
+
"build": "rollup -c",
|
|
28
28
|
"test": "./test.sh",
|
|
29
29
|
"test:ts": "tsd ./test/ts"
|
|
30
30
|
},
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/knowledgecode/date-and-time",
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@
|
|
49
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
50
50
|
"expect.js": "^0.3.1",
|
|
51
|
-
"mocha": "^10.
|
|
51
|
+
"mocha": "^10.2.0",
|
|
52
52
|
"mocha-headless-chrome": "^4.0.0",
|
|
53
|
-
"rollup": "^
|
|
54
|
-
"tsd": "^0.
|
|
53
|
+
"rollup": "^3.19.1",
|
|
54
|
+
"tsd": "^0.27.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/plugin/timezone.js
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
var dateString2 = date.format(localized_date.parse(dateString, pattern2), pattern);
|
|
51
51
|
|
|
52
52
|
var comparer = function (d) {
|
|
53
|
-
return dateString2 === dateTimeFormat.format(d);
|
|
53
|
+
return dateString2 === dateTimeFormat.format(d).replace(/[\u202f]/, ' ');
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
// Trying to adjust for daylight saving time.
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import terser from '@rollup/plugin-terser';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
input: 'src/index.js',
|
|
6
|
+
output: [
|
|
7
|
+
{ file: 'esm/date-and-time.es.js', format: 'es' },
|
|
8
|
+
{ file: 'esm/date-and-time.mjs', format: 'es' },
|
|
9
|
+
{ file: 'date-and-time.js', format: 'umd', name: 'date', esModule: false }
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
input: 'src/locale/ar.js',
|
|
14
|
+
output: [
|
|
15
|
+
{ file: 'esm/locale/ar.es.js', format: 'es' },
|
|
16
|
+
{ file: 'esm/locale/ar.mjs', format: 'es' },
|
|
17
|
+
{ file: 'locale/ar.js', format: 'umd', name: 'date.locale.ar', esModule: false }
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
input: 'src/locale/az.js',
|
|
22
|
+
output: [
|
|
23
|
+
{ file: 'esm/locale/az.es.js', format: 'es' },
|
|
24
|
+
{ file: 'esm/locale/az.mjs', format: 'es' },
|
|
25
|
+
{ file: 'locale/az.js', format: 'umd', name: 'date.locale.az', esModule: false }
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
input: 'src/locale/bn.js',
|
|
30
|
+
output: [
|
|
31
|
+
{ file: 'esm/locale/bn.es.js', format: 'es' },
|
|
32
|
+
{ file: 'esm/locale/bn.mjs', format: 'es' },
|
|
33
|
+
{ file: 'locale/bn.js', format: 'umd', name: 'date.locale.bn', esModule: false }
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
input: 'src/locale/cs.js',
|
|
38
|
+
output: [
|
|
39
|
+
{ file: 'esm/locale/cs.es.js', format: 'es' },
|
|
40
|
+
{ file: 'esm/locale/cs.mjs', format: 'es' },
|
|
41
|
+
{ file: 'locale/cs.js', format: 'umd', name: 'date.locale.cs', esModule: false }
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
input: 'src/locale/de.js',
|
|
46
|
+
output: [
|
|
47
|
+
{ file: 'esm/locale/de.es.js', format: 'es' },
|
|
48
|
+
{ file: 'esm/locale/de.mjs', format: 'es' },
|
|
49
|
+
{ file: 'locale/de.js', format: 'umd', name: 'date.locale.de', esModule: false }
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
input: 'src/locale/dk.js',
|
|
54
|
+
output: [
|
|
55
|
+
{ file: 'esm/locale/dk.es.js', format: 'es' },
|
|
56
|
+
{ file: 'esm/locale/dk.mjs', format: 'es' },
|
|
57
|
+
{ file: 'locale/dk.js', format: 'umd', name: 'date.locale.dk', esModule: false }
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
input: 'src/locale/el.js',
|
|
62
|
+
output: [
|
|
63
|
+
{ file: 'esm/locale/el.es.js', format: 'es' },
|
|
64
|
+
{ file: 'esm/locale/el.mjs', format: 'es' },
|
|
65
|
+
{ file: 'locale/el.js', format: 'umd', name: 'date.locale.el', esModule: false }
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
input: 'src/locale/en.js',
|
|
70
|
+
output: [
|
|
71
|
+
{ file: 'esm/locale/en.es.js', format: 'es' },
|
|
72
|
+
{ file: 'esm/locale/en.mjs', format: 'es' },
|
|
73
|
+
{ file: 'locale/en.js', format: 'umd', name: 'date.locale.en', esModule: false }
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
input: 'src/locale/es.js',
|
|
78
|
+
output: [
|
|
79
|
+
{ file: 'esm/locale/es.es.js', format: 'es' },
|
|
80
|
+
{ file: 'esm/locale/es.mjs', format: 'es' },
|
|
81
|
+
{ file: 'locale/es.js', format: 'umd', name: 'date.locale.es', esModule: false }
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
input: 'src/locale/fa.js',
|
|
86
|
+
output: [
|
|
87
|
+
{ file: 'esm/locale/fa.es.js', format: 'es' },
|
|
88
|
+
{ file: 'esm/locale/fa.mjs', format: 'es' },
|
|
89
|
+
{ file: 'locale/fa.js', format: 'umd', name: 'date.locale.fa', esModule: false }
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
input: 'src/locale/fr.js',
|
|
94
|
+
output: [
|
|
95
|
+
{ file: 'esm/locale/fr.es.js', format: 'es' },
|
|
96
|
+
{ file: 'esm/locale/fr.mjs', format: 'es' },
|
|
97
|
+
{ file: 'locale/fr.js', format: 'umd', name: 'date.locale.fr', esModule: false }
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
input: 'src/locale/hi.js',
|
|
102
|
+
output: [
|
|
103
|
+
{ file: 'esm/locale/hi.es.js', format: 'es' },
|
|
104
|
+
{ file: 'esm/locale/hi.mjs', format: 'es' },
|
|
105
|
+
{ file: 'locale/hi.js', format: 'umd', name: 'date.locale.hi', esModule: false }
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
input: 'src/locale/hu.js',
|
|
110
|
+
output: [
|
|
111
|
+
{ file: 'esm/locale/hu.es.js', format: 'es' },
|
|
112
|
+
{ file: 'esm/locale/hu.mjs', format: 'es' },
|
|
113
|
+
{ file: 'locale/hu.js', format: 'umd', name: 'date.locale.hu', esModule: false }
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
input: 'src/locale/id.js',
|
|
118
|
+
output: [
|
|
119
|
+
{ file: 'esm/locale/id.es.js', format: 'es' },
|
|
120
|
+
{ file: 'esm/locale/id.mjs', format: 'es' },
|
|
121
|
+
{ file: 'locale/id.js', format: 'umd', name: 'date.locale.id', esModule: false }
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
input: 'src/locale/it.js',
|
|
126
|
+
output: [
|
|
127
|
+
{ file: 'esm/locale/it.es.js', format: 'es' },
|
|
128
|
+
{ file: 'esm/locale/it.mjs', format: 'es' },
|
|
129
|
+
{ file: 'locale/it.js', format: 'umd', name: 'date.locale.it', esModule: false }
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
input: 'src/locale/ja.js',
|
|
134
|
+
output: [
|
|
135
|
+
{ file: 'esm/locale/ja.es.js', format: 'es' },
|
|
136
|
+
{ file: 'esm/locale/ja.mjs', format: 'es' },
|
|
137
|
+
{ file: 'locale/ja.js', format: 'umd', name: 'date.locale.ja', esModule: false }
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
input: 'src/locale/jv.js',
|
|
142
|
+
output: [
|
|
143
|
+
{ file: 'esm/locale/jv.es.js', format: 'es' },
|
|
144
|
+
{ file: 'esm/locale/jv.mjs', format: 'es' },
|
|
145
|
+
{ file: 'locale/jv.js', format: 'umd', name: 'date.locale.jv', esModule: false }
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
input: 'src/locale/ko.js',
|
|
150
|
+
output: [
|
|
151
|
+
{ file: 'esm/locale/ko.es.js', format: 'es' },
|
|
152
|
+
{ file: 'esm/locale/ko.mjs', format: 'es' },
|
|
153
|
+
{ file: 'locale/ko.js', format: 'umd', name: 'date.locale.ko', esModule: false }
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
input: 'src/locale/my.js',
|
|
158
|
+
output: [
|
|
159
|
+
{ file: 'esm/locale/my.es.js', format: 'es' },
|
|
160
|
+
{ file: 'esm/locale/my.mjs', format: 'es' },
|
|
161
|
+
{ file: 'locale/my.js', format: 'umd', name: 'date.locale.my', esModule: false }
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
input: 'src/locale/nl.js',
|
|
166
|
+
output: [
|
|
167
|
+
{ file: 'esm/locale/nl.es.js', format: 'es' },
|
|
168
|
+
{ file: 'esm/locale/nl.mjs', format: 'es' },
|
|
169
|
+
{ file: 'locale/nl.js', format: 'umd', name: 'date.locale.nl', esModule: false }
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
input: 'src/locale/pa-in.js',
|
|
174
|
+
output: [
|
|
175
|
+
{ file: 'esm/locale/pa-in.es.js', format: 'es' },
|
|
176
|
+
{ file: 'esm/locale/pa-in.mjs', format: 'es' },
|
|
177
|
+
{ file: 'locale/pa-in.js', format: 'umd', name: 'date.locale.pa-in', esModule: false }
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
input: 'src/locale/pl.js',
|
|
182
|
+
output: [
|
|
183
|
+
{ file: 'esm/locale/pl.es.js', format: 'es' },
|
|
184
|
+
{ file: 'esm/locale/pl.mjs', format: 'es' },
|
|
185
|
+
{ file: 'locale/pl.js', format: 'umd', name: 'date.locale.pl', esModule: false }
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
input: 'src/locale/pt.js',
|
|
190
|
+
output: [
|
|
191
|
+
{ file: 'esm/locale/pt.es.js', format: 'es' },
|
|
192
|
+
{ file: 'esm/locale/pt.mjs', format: 'es' },
|
|
193
|
+
{ file: 'locale/pt.js', format: 'umd', name: 'date.locale.pt', esModule: false }
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
input: 'src/locale/ro.js',
|
|
198
|
+
output: [
|
|
199
|
+
{ file: 'esm/locale/ro.es.js', format: 'es' },
|
|
200
|
+
{ file: 'esm/locale/ro.mjs', format: 'es' },
|
|
201
|
+
{ file: 'locale/ro.js', format: 'umd', name: 'date.locale.ro', esModule: false }
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
input: 'src/locale/ru.js',
|
|
206
|
+
output: [
|
|
207
|
+
{ file: 'esm/locale/ru.es.js', format: 'es' },
|
|
208
|
+
{ file: 'esm/locale/ru.mjs', format: 'es' },
|
|
209
|
+
{ file: 'locale/ru.js', format: 'umd', name: 'date.locale.ru', esModule: false }
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
input: 'src/locale/rw.js',
|
|
214
|
+
output: [
|
|
215
|
+
{ file: 'esm/locale/rw.es.js', format: 'es' },
|
|
216
|
+
{ file: 'esm/locale/rw.mjs', format: 'es' },
|
|
217
|
+
{ file: 'locale/rw.js', format: 'umd', name: 'date.locale.rw', esModule: false }
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
input: 'src/locale/sr.js',
|
|
222
|
+
output: [
|
|
223
|
+
{ file: 'esm/locale/sr.es.js', format: 'es' },
|
|
224
|
+
{ file: 'esm/locale/sr.mjs', format: 'es' },
|
|
225
|
+
{ file: 'locale/sr.js', format: 'umd', name: 'date.locale.sr', esModule: false }
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
input: 'src/locale/sv.js',
|
|
230
|
+
output: [
|
|
231
|
+
{ file: 'esm/locale/sv.es.js', format: 'es' },
|
|
232
|
+
{ file: 'esm/locale/sv.mjs', format: 'es' },
|
|
233
|
+
{ file: 'locale/sv.js', format: 'umd', name: 'date.locale.sv', esModule: false }
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
input: 'src/locale/th.js',
|
|
238
|
+
output: [
|
|
239
|
+
{ file: 'esm/locale/th.es.js', format: 'es' },
|
|
240
|
+
{ file: 'esm/locale/th.mjs', format: 'es' },
|
|
241
|
+
{ file: 'locale/th.js', format: 'umd', name: 'date.locale.th', esModule: false }
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
input: 'src/locale/tr.js',
|
|
246
|
+
output: [
|
|
247
|
+
{ file: 'esm/locale/tr.es.js', format: 'es' },
|
|
248
|
+
{ file: 'esm/locale/tr.mjs', format: 'es' },
|
|
249
|
+
{ file: 'locale/tr.js', format: 'umd', name: 'date.locale.tr', esModule: false }
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
input: 'src/locale/uk.js',
|
|
254
|
+
output: [
|
|
255
|
+
{ file: 'esm/locale/uk.es.js', format: 'es' },
|
|
256
|
+
{ file: 'esm/locale/uk.mjs', format: 'es' },
|
|
257
|
+
{ file: 'locale/uk.js', format: 'umd', name: 'date.locale.uk', esModule: false }
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
input: 'src/locale/uz.js',
|
|
262
|
+
output: [
|
|
263
|
+
{ file: 'esm/locale/uz.es.js', format: 'es' },
|
|
264
|
+
{ file: 'esm/locale/uz.mjs', format: 'es' },
|
|
265
|
+
{ file: 'locale/uz.js', format: 'umd', name: 'date.locale.uz', esModule: false }
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
input: 'src/locale/vi.js',
|
|
270
|
+
output: [
|
|
271
|
+
{ file: 'esm/locale/vi.es.js', format: 'es' },
|
|
272
|
+
{ file: 'esm/locale/vi.mjs', format: 'es' },
|
|
273
|
+
{ file: 'locale/vi.js', format: 'umd', name: 'date.locale.vi', esModule: false }
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
input: 'src/locale/zh-cn.js',
|
|
278
|
+
output: [
|
|
279
|
+
{ file: 'esm/locale/zh-cn.es.js', format: 'es' },
|
|
280
|
+
{ file: 'esm/locale/zh-cn.mjs', format: 'es' },
|
|
281
|
+
{ file: 'locale/zh-cn.js', format: 'umd', name: 'date.locale.zh-cn', esModule: false }
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
input: 'src/locale/zh-tw.js',
|
|
286
|
+
output: [
|
|
287
|
+
{ file: 'esm/locale/zh-tw.es.js', format: 'es' },
|
|
288
|
+
{ file: 'esm/locale/zh-tw.mjs', format: 'es' },
|
|
289
|
+
{ file: 'locale/zh-tw.js', format: 'umd', name: 'date.locale.zh-tw', esModule: false }
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
input: 'src/plugin/day-of-week.js',
|
|
294
|
+
output: [
|
|
295
|
+
{ file: 'esm/plugin/day-of-week.es.js', format: 'es' },
|
|
296
|
+
{ file: 'esm/plugin/day-of-week.mjs', format: 'es' },
|
|
297
|
+
{ file: 'plugin/day-of-week.js', format: 'umd', name: 'date.plugin.day-of-week', esModule: false }
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
input: 'src/plugin/meridiem.js',
|
|
302
|
+
output: [
|
|
303
|
+
{ file: 'esm/plugin/meridiem.es.js', format: 'es' },
|
|
304
|
+
{ file: 'esm/plugin/meridiem.mjs', format: 'es' },
|
|
305
|
+
{ file: 'plugin/meridiem.js', format: 'umd', name: 'date.plugin.meridiem', esModule: false }
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
input: 'src/plugin/microsecond.js',
|
|
310
|
+
output: [
|
|
311
|
+
{ file: 'esm/plugin/microsecond.es.js', format: 'es' },
|
|
312
|
+
{ file: 'esm/plugin/microsecond.mjs', format: 'es' },
|
|
313
|
+
{ file: 'plugin/microsecond.js', format: 'umd', name: 'date.plugin.microsecond', esModule: false }
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
input: 'src/plugin/ordinal.js',
|
|
318
|
+
output: [
|
|
319
|
+
{ file: 'esm/plugin/ordinal.es.js', format: 'es' },
|
|
320
|
+
{ file: 'esm/plugin/ordinal.mjs', format: 'es' },
|
|
321
|
+
{ file: 'plugin/ordinal.js', format: 'umd', name: 'date.plugin.ordinal', esModule: false }
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
input: 'src/plugin/timespan.js',
|
|
326
|
+
output: [
|
|
327
|
+
{ file: 'esm/plugin/timespan.es.js', format: 'es' },
|
|
328
|
+
{ file: 'esm/plugin/timespan.mjs', format: 'es' },
|
|
329
|
+
{ file: 'plugin/timespan.js', format: 'umd', name: 'date.plugin.timespan', esModule: false }
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
input: 'src/plugin/timezone.js',
|
|
334
|
+
output: [
|
|
335
|
+
{ file: 'esm/plugin/timezone.es.js', format: 'es' },
|
|
336
|
+
{ file: 'esm/plugin/timezone.mjs', format: 'es' },
|
|
337
|
+
{ file: 'plugin/timezone.js', format: 'umd', name: 'date.plugin.timezone', esModule: false }
|
|
338
|
+
]
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
input: 'src/plugin/two-digit-year.js',
|
|
342
|
+
output: [
|
|
343
|
+
{ file: 'esm/plugin/two-digit-year.es.js', format: 'es' },
|
|
344
|
+
{ file: 'esm/plugin/two-digit-year.mjs', format: 'es' },
|
|
345
|
+
{ file: 'plugin/two-digit-year.js', format: 'umd', name: 'date.plugin.two-digit-year', esModule: false }
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
input: 'src/index.js',
|
|
350
|
+
output: [
|
|
351
|
+
{ file: 'esm/date-and-time.es.min.js', format: 'es' },
|
|
352
|
+
{ file: 'date-and-time.min.js', format: 'umd', name: 'date', esModule: false }
|
|
353
|
+
],
|
|
354
|
+
plugins: [terser()]
|
|
355
|
+
}
|
|
356
|
+
];
|