Socket
Socket
Sign inDemoInstall

date-and-time

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-and-time - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

11

date-and-time.js

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.date = factory());
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -410,2 +410,3 @@ /**

var localized_proto = extend(proto);
var date = extend(proto);

@@ -431,4 +432,4 @@

date._formatter = formatter;
date._parser = parser;
date._formatter = localized_proto._formatter = formatter;
date._parser = localized_proto._parser = parser;

@@ -470,3 +471,3 @@ for (var plugin in plugins) {

if (install) {
date.extend(plugins[install(proto)] || {});
date.extend(plugins[install(proto, localized_proto)] || {});
}

@@ -477,2 +478,2 @@ };

})));
}));
/*
date-and-time (c) KNOWLEDGECODE | MIT
*/
'use strict';(function(m,l){"object"===typeof exports&&"undefined"!==typeof module?module.exports=l():"function"===typeof define&&define.amd?define(l):(m="undefined"!==typeof globalThis?globalThis:m||self,m.date=l())})(this,function(){var m={},l={},q="en",r={MMMM:"January February March April May June July August September October November December".split(" "),MMM:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),dddd:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
ddd:"Sun Mon Tue Wed Thu Fri Sat".split(" "),dd:"Su Mo Tu We Th Fr Sa".split(" "),A:["AM","PM"]},v={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)},
'use strict';(function(n,l){"object"===typeof exports&&"undefined"!==typeof module?module.exports=l():"function"===typeof define&&define.amd?define(l):(n="undefined"!==typeof globalThis?globalThis:n||self,n.date=l())})(this,function(){var n={},l={},q="en",t={MMMM:"January February March April May June July August September October November December".split(" "),MMM:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),dddd:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
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)},
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)},
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)},post:function(a){return a},res:r},w={YYYY:function(a){return this.exec(/^\d{4}/,a)},Y:function(a){return this.exec(/^\d{1,4}/,a)},
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)},post:function(a){return a},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,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/100|0)-a.value%100;return a},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 c=-1,d=0,f=0,e=a.length,k;f<e;f++)k=a[f],!b.indexOf(k)&&k.length>d&&(c=f,d=k.length);return{value:c,length:d}},pre:function(a){return a},res:r},n=function(a,b,c,d){var f={},e;for(e in a)f[e]=a[e];for(e in b||{})!!c^!!f[e]||(f[e]=b[e]);d&&(f.res=d);return f},u={_formatter:v,_parser:w,compile:function(a){for(var b=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,c,d=[a];c=b.exec(a);)d[d.length]=c[0];return d},
format:function(a,b,c){b="string"===typeof b?this.compile(b):b;var d=a.getTimezoneOffset();a=this.addMinutes(a,c?d:0);var f=this._formatter,e="";a.getTimezoneOffset=function(){return c?0:d};for(var k=1,t=b.length,h;k<t;k++)h=b[k],e+=f[h]?f.post(f[h](a,b[0])):h.replace(/\[(.*)]/,"$1");return e},preparse:function(a,b){b="string"===typeof b?this.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},d=/\[(.*)]/,f=this._parser,e=0;a=f.pre(a);for(var k=1,t=b.length,
h,p;k<t;k++)if(h=b[k],f[h]){p=f[h](a.slice(e),b[0]);if(!p.length)break;e+=p.length;c[p.token||h.charAt(0)]=p.value;c._match++}else if(h===a.charAt(e)||" "===h)e++;else if(d.test(h)&&!a.slice(e).indexOf(d.exec(h)[1]))e+=h.length-2;else{"..."===h&&(e=a.length);break}c.H=c.H||f.h12(c.h,c.A);c._index=e;c._length=a.length;return c},parse:function(a,b,c){a=this.preparse(a,b);return this.isValid(a)?(a.M-=100>a.Y?22801:1,c||a.Z?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,
b){a=(a.exec(b)||[""])[0];return{value:a|0,length:a.length}},find:function(a,b){for(var c=-1,d=0,f=0,e=a.length,k;f<e;f++)k=a[f],!b.indexOf(k)&&k.length>d&&(c=f,d=k.length);return{value:c,length:d}},pre:function(a){return a},res:t},m=function(a,b,c,d){var f={},e;for(e in a)f[e]=a[e];for(e in b||{})!!c^!!f[e]||(f[e]=b[e]);d&&(f.res=d);return f},r={_formatter:w,_parser:x,compile:function(a){for(var b=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,c,d=[a];c=b.exec(a);)d[d.length]=c[0];return d},
format:function(a,b,c){b="string"===typeof b?this.compile(b):b;var d=a.getTimezoneOffset();a=this.addMinutes(a,c?d:0);var f=this._formatter,e="";a.getTimezoneOffset=function(){return c?0:d};for(var k=1,u=b.length,h;k<u;k++)h=b[k],e+=f[h]?f.post(f[h](a,b[0])):h.replace(/\[(.*)]/,"$1");return e},preparse:function(a,b){b="string"===typeof b?this.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},d=/\[(.*)]/,f=this._parser,e=0;a=f.pre(a);for(var k=1,u=b.length,
h,p;k<u;k++)if(h=b[k],f[h]){p=f[h](a.slice(e),b[0]);if(!p.length)break;e+=p.length;c[p.token||h.charAt(0)]=p.value;c._match++}else if(h===a.charAt(e)||" "===h)e++;else if(d.test(h)&&!a.slice(e).indexOf(d.exec(h)[1]))e+=h.length-2;else{"..."===h&&(e=a.length);break}c.H=c.H||f.h12(c.h,c.A);c._index=e;c._length=a.length;return c},parse:function(a,b,c){a=this.preparse(a,b);return this.isValid(a)?(a.M-=100>a.Y?22801:1,c||a.Z?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)},isValid:function(a,b){a="string"===typeof a?this.preparse(a,b):a;b=[31,28+this.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>b||0>a.H||23<a.H||0>a.m||59<a.m||0>a.s||59<a.s||0>a.S||999<a.S||-720>a.Z||840<a.Z)},transform:function(a,b,c,d){return this.format(this.parse(a,b),c,d)},addYears:function(a,b){return this.addMonths(a,12*b)},addMonths:function(a,b){a=
new Date(a.getTime());a.setMonth(a.getMonth()+b);return a},addDays:function(a,b){a=new Date(a.getTime());a.setDate(a.getDate()+b);return a},addHours:function(a,b){return this.addMinutes(a,60*b)},addMinutes:function(a,b){return this.addSeconds(a,60*b)},addSeconds:function(a,b){return this.addMilliseconds(a,1E3*b)},addMilliseconds:function(a,b){return new Date(a.getTime()+b)},subtract:function(a,b){var c=a.getTime()-b.getTime();return{toMilliseconds:function(){return c},toSeconds:function(){return c/
1E3},toMinutes:function(){return c/6E4},toHours:function(){return c/36E5},toDays:function(){return c/864E5}}},isLeapYear:function(a){return!(a%4)&&!!(a%100)||!(a%400)},isSameDay:function(a,b){return a.toDateString()===b.toDateString()},locale:function(a,b){m[a]||(m[a]=b)},plugin:function(a,b){l[a]||(l[a]=b)}},g=n(u);g.locale=function(a){a="function"===typeof a?a:g.locale[a];if(!a)return q;q=a(u);var b=m[q]||{},c=n(r,b.res,!0);a=n(v,b.formatter,!0,c);b=n(w,b.parser,!0,c);g._formatter=a;g._parser=b;
for(var d in l)g.extend(l[d]);return q};g.extend=function(a){var b=n(g._parser.res,a.res),c=a.extender||{};g._formatter=n(g._formatter,a.formatter,!1,b);g._parser=n(g._parser,a.parser,!1,b);for(var d in c)g[d]||(g[d]=c[d])};g.plugin=function(a){(a="function"===typeof a?a:g.plugin[a])&&g.extend(l[a(u)]||{})};return g})
1E3},toMinutes:function(){return c/6E4},toHours:function(){return c/36E5},toDays:function(){return c/864E5}}},isLeapYear:function(a){return!(a%4)&&!!(a%100)||!(a%400)},isSameDay:function(a,b){return a.toDateString()===b.toDateString()},locale:function(a,b){n[a]||(n[a]=b)},plugin:function(a,b){l[a]||(l[a]=b)}},v=m(r),g=m(r);g.locale=function(a){a="function"===typeof a?a:g.locale[a];if(!a)return q;q=a(r);var b=n[q]||{},c=m(t,b.res,!0);a=m(w,b.formatter,!0,c);b=m(x,b.parser,!0,c);g._formatter=v._formatter=
a;g._parser=v._parser=b;for(var d in l)g.extend(l[d]);return q};g.extend=function(a){var b=m(g._parser.res,a.res),c=a.extender||{};g._formatter=m(g._formatter,a.formatter,!1,b);g._parser=m(g._parser,a.parser,!1,b);for(var d in c)g[d]||(g[d]=c[d])};g.plugin=function(a){(a="function"===typeof a?a:g.plugin[a])&&g.extend(l[a(r,v)]||{})};return g})

@@ -403,2 +403,3 @@ /**

var localized_proto = extend(proto);
var date = extend(proto);

@@ -424,4 +425,4 @@

date._formatter = formatter;
date._parser = parser;
date._formatter = localized_proto._formatter = formatter;
date._parser = localized_proto._parser = parser;

@@ -463,3 +464,3 @@ for (var plugin in plugins) {

if (install) {
date.extend(plugins[install(proto)] || {});
date.extend(plugins[install(proto, localized_proto)] || {});
}

@@ -466,0 +467,0 @@ };

@@ -10,9 +10,9 @@ /*

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},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 c=-1,d=0,f=0,e=a.length,k;f<e;f++)k=a[f],!b.indexOf(k)&&k.length>d&&(c=f,d=k.length);return{value:c,length:d}},pre:function(a){return a},
res:p};function u(a,b,c,d){var f={},e;for(e in a)f[e]=a[e];for(e in b||{})!!c^!!f[e]||(f[e]=b[e]);d&&(f.res=d);return f}
var v={_formatter:q,_parser:r,compile:function(a){for(var b=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,c,d=[a];c=b.exec(a);)d[d.length]=c[0];return d},format:function(a,b,c){b="string"===typeof b?this.compile(b):b;var d=a.getTimezoneOffset();a=this.addMinutes(a,c?d:0);var f=this._formatter,e="";a.getTimezoneOffset=function(){return c?0:d};for(var k=1,t=b.length,h;k<t;k++)h=b[k],e+=f[h]?f.post(f[h](a,b[0])):h.replace(/\[(.*)]/,"$1");return e},preparse:function(a,b){b="string"===typeof b?this.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},d=/\[(.*)]/,f=this._parser,e=0;a=f.pre(a);for(var k=1,t=b.length,h,n;k<t;k++)if(h=b[k],f[h]){n=f[h](a.slice(e),b[0]);if(!n.length)break;e+=n.length;c[n.token||h.charAt(0)]=n.value;c._match++}else if(h===a.charAt(e)||" "===h)e++;else if(d.test(h)&&!a.slice(e).indexOf(d.exec(h)[1]))e+=h.length-2;else{"..."===h&&(e=a.length);break}c.H=c.H||f.h12(c.h,c.A);c._index=e;c._length=a.length;return c},parse:function(a,b,c){a=this.preparse(a,
res:p};function t(a,b,c,d){var f={},e;for(e in a)f[e]=a[e];for(e in b||{})!!c^!!f[e]||(f[e]=b[e]);d&&(f.res=d);return f}
var v={_formatter:q,_parser:r,compile:function(a){for(var b=/\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g,c,d=[a];c=b.exec(a);)d[d.length]=c[0];return d},format:function(a,b,c){b="string"===typeof b?this.compile(b):b;var d=a.getTimezoneOffset();a=this.addMinutes(a,c?d:0);var f=this._formatter,e="";a.getTimezoneOffset=function(){return c?0:d};for(var k=1,u=b.length,h;k<u;k++)h=b[k],e+=f[h]?f.post(f[h](a,b[0])):h.replace(/\[(.*)]/,"$1");return e},preparse:function(a,b){b="string"===typeof b?this.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},d=/\[(.*)]/,f=this._parser,e=0;a=f.pre(a);for(var k=1,u=b.length,h,n;k<u;k++)if(h=b[k],f[h]){n=f[h](a.slice(e),b[0]);if(!n.length)break;e+=n.length;c[n.token||h.charAt(0)]=n.value;c._match++}else if(h===a.charAt(e)||" "===h)e++;else if(d.test(h)&&!a.slice(e).indexOf(d.exec(h)[1]))e+=h.length-2;else{"..."===h&&(e=a.length);break}c.H=c.H||f.h12(c.h,c.A);c._index=e;c._length=a.length;return c},parse:function(a,b,c){a=this.preparse(a,
b);return this.isValid(a)?(a.M-=100>a.Y?22801:1,c||a.Z?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)},isValid:function(a,b){a="string"===typeof a?this.preparse(a,b):a;b=[31,28+this.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>b||0>a.H||23<a.H||0>a.m||59<a.m||0>a.s||59<a.s||0>a.S||999<a.S||-720>a.Z||840<a.Z)},transform:function(a,
b,c,d){return this.format(this.parse(a,b),c,d)},addYears:function(a,b){return this.addMonths(a,12*b)},addMonths:function(a,b){a=new Date(a.getTime());a.setMonth(a.getMonth()+b);return a},addDays:function(a,b){a=new Date(a.getTime());a.setDate(a.getDate()+b);return a},addHours:function(a,b){return this.addMinutes(a,60*b)},addMinutes:function(a,b){return this.addSeconds(a,60*b)},addSeconds:function(a,b){return this.addMilliseconds(a,1E3*b)},addMilliseconds:function(a,b){return new Date(a.getTime()+
b)},subtract:function(a,b){var c=a.getTime()-b.getTime();return{toMilliseconds:function(){return c},toSeconds:function(){return c/1E3},toMinutes:function(){return c/6E4},toHours:function(){return c/36E5},toDays:function(){return c/864E5}}},isLeapYear:function(a){return!(a%4)&&!!(a%100)||!(a%400)},isSameDay:function(a,b){return a.toDateString()===b.toDateString()},locale:function(a,b){g[a]||(g[a]=b)},plugin:function(a,b){l[a]||(l[a]=b)}},w=u(v);
w.locale=function(a){a="function"===typeof a?a:w.locale[a];if(!a)return m;m=a(v);var b=g[m]||{},c=u(p,b.res,!0);a=u(q,b.formatter,!0,c);b=u(r,b.parser,!0,c);w._formatter=a;w._parser=b;for(var d in l)w.extend(l[d]);return m};w.extend=function(a){var b=u(w._parser.res,a.res),c=a.extender||{};w._formatter=u(w._formatter,a.formatter,!1,b);w._parser=u(w._parser,a.parser,!1,b);for(var d in c)w[d]||(w[d]=c[d])};w.plugin=function(a){(a="function"===typeof a?a:w.plugin[a])&&w.extend(l[a(v)]||{})};
export default w
b)},subtract:function(a,b){var c=a.getTime()-b.getTime();return{toMilliseconds:function(){return c},toSeconds:function(){return c/1E3},toMinutes:function(){return c/6E4},toHours:function(){return c/36E5},toDays:function(){return c/864E5}}},isLeapYear:function(a){return!(a%4)&&!!(a%100)||!(a%400)},isSameDay:function(a,b){return a.toDateString()===b.toDateString()},locale:function(a,b){g[a]||(g[a]=b)},plugin:function(a,b){l[a]||(l[a]=b)}},w=t(v),x=t(v);
x.locale=function(a){a="function"===typeof a?a:x.locale[a];if(!a)return m;m=a(v);var b=g[m]||{},c=t(p,b.res,!0);a=t(q,b.formatter,!0,c);b=t(r,b.parser,!0,c);x._formatter=w._formatter=a;x._parser=w._parser=b;for(var d in l)x.extend(l[d]);return m};x.extend=function(a){var b=t(x._parser.res,a.res),c=a.extender||{};x._formatter=t(x._formatter,a.formatter,!1,b);x._parser=t(x._parser,a.parser,!1,b);for(var d in c)x[d]||(x[d]=c[d])};
x.plugin=function(a){(a="function"===typeof a?a:x.plugin[a])&&x.extend(l[a(v,w)]||{})};export default x

@@ -6,3 +6,3 @@ /**

var plugin = function (date) {
var plugin = function (date, localized_date) {
var options = {

@@ -23,3 +23,3 @@ year: 'numeric', month: 'numeric', day: 'numeric',

dateObj3.getTimezoneOffset = function () { return (utcObj.getTime() - dateObj2.getTime()) / 60000 | 0; };
return date.format(dateObj3, arg);
return localized_date.format(dateObj3, arg);
};

@@ -33,3 +33,3 @@ var adjustments = [

var pattern2 = typeof arg === 'string' ? date.compile(arg) : arg;
var dateObj = date.parse(dateString, pattern2, true);
var dateObj = localized_date.parse(dateString, pattern2, true);

@@ -49,3 +49,3 @@ for (var i = 1, len = pattern2.length; i < len; i++) {

var offset = dateObj.getTime() - dateObj2.getTime();
var dateString2 = date.transform(dateString, pattern2, pattern);
var dateString2 = date.format(localized_date.parse(dateString, pattern2), pattern);

@@ -52,0 +52,0 @@ var comparer = function (d) {

@@ -104,1 +104,5 @@ # Extension

Extending the parser may be a bit difficult. Refer to the library source code to grasp the default behavior.
## Caveats
Note that switching locales or applying plugins after extending the library will be cleared all extensions. In such cases, you need to extend the library again.

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ar = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -48,2 +48,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.az = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -53,2 +53,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.bn = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -59,2 +59,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.cs = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -31,2 +31,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.de = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -32,2 +32,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.dk = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -31,2 +31,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.el = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -53,2 +53,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.en = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -22,2 +22,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.es = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -51,2 +51,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.fa = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -48,2 +48,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.fr = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -32,2 +32,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.hi = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -59,2 +59,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.hu = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -32,2 +32,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.id = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -55,2 +55,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.it = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -32,2 +32,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ja = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -40,2 +40,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.jv = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -55,2 +55,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ko = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -32,2 +32,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.my = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -47,2 +47,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.nl = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -46,2 +46,2 @@ /**

})));
}));
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale['pa-in'] = factory()));
}(this, (function () { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale["pa-in"] = factory()));
})(this, (function () { 'use strict';

@@ -70,2 +70,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.pl = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -46,2 +46,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.pt = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -53,2 +53,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ro = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -31,2 +31,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.ru = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -53,2 +53,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.rw = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -31,2 +31,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.sr = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -31,2 +31,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.th = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -32,2 +32,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.tr = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -31,2 +31,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.uk = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -66,2 +66,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.uz = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -31,2 +31,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale.vi = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -32,2 +32,2 @@ /**

})));
}));
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale['zh-cn'] = factory()));
}(this, (function () { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale["zh-cn"] = factory()));
})(this, (function () { 'use strict';

@@ -56,2 +56,2 @@ /**

})));
}));
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale['zh-tw'] = factory()));
}(this, (function () { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.locale = global.date.locale || {}, global.date.locale["zh-tw"] = factory()));
})(this, (function () { 'use strict';

@@ -54,2 +54,2 @@ /**

})));
}));
{
"name": "date-and-time",
"version": "2.0.0",
"version": "2.0.1",
"description": "A Minimalist DateTime utility for Node.js and the browser",

@@ -49,6 +49,6 @@ "main": "date-and-time.js",

"expect.js": "^0.3.1",
"mocha": "^9.0.3",
"mocha": "^9.1.2",
"mocha-headless-chrome": "^3.1.0",
"rollup": "^2.56.2"
"rollup": "^2.58.0"
}
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin['day-of-week'] = factory()));
}(this, (function () { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin["day-of-week"] = factory()));
})(this, (function () { 'use strict';

@@ -27,2 +27,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.meridiem = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -56,2 +56,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.microsecond = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -40,2 +40,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.ordinal = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -43,2 +43,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.timespan = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -84,2 +84,2 @@ /**

})));
}));

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.timezone = factory()));
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';

@@ -13,3 +13,3 @@ /**

var plugin = function (date) {
var plugin = function (date, localized_date) {
var options = {

@@ -30,3 +30,3 @@ year: 'numeric', month: 'numeric', day: 'numeric',

dateObj3.getTimezoneOffset = function () { return (utcObj.getTime() - dateObj2.getTime()) / 60000 | 0; };
return date.format(dateObj3, arg);
return localized_date.format(dateObj3, arg);
};

@@ -40,3 +40,3 @@ var adjustments = [

var pattern2 = typeof arg === 'string' ? date.compile(arg) : arg;
var dateObj = date.parse(dateString, pattern2, true);
var dateObj = localized_date.parse(dateString, pattern2, true);

@@ -56,3 +56,3 @@ for (var i = 1, len = pattern2.length; i < len; i++) {

var offset = dateObj.getTime() - dateObj2.getTime();
var dateString2 = date.transform(dateString, pattern2, pattern);
var dateString2 = date.format(localized_date.parse(dateString, pattern2), pattern);

@@ -86,2 +86,2 @@ var comparer = function (d) {

})));
}));
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin['two-digit-year'] = factory()));
}(this, (function () { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin["two-digit-year"] = factory()));
})(this, (function () { 'use strict';

@@ -29,2 +29,2 @@ /**

})));
}));

@@ -27,2 +27,5 @@ # date-and-time

- 2.0.1
- Fixed a bug that the timezone plugin does not support changing locales.
- 2.0.0

@@ -36,7 +39,2 @@ - Fixed a conflict when importing multiple plugins and locales.

- 1.0.0
- **First stable release!**
- ES Modules support.
- Added Kinyarwanda support.
## Usage

@@ -43,0 +41,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc