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.1.1 to 2.1.2

2

date-and-time.js

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

dt.H < 0 || dt.H > 23 || dt.m < 0 || dt.m > 59 || dt.s < 0 || dt.s > 59 || dt.S < 0 || dt.S > 999 ||
dt.Z < -720 || dt.Z > 840
dt.Z < -840 || dt.Z > 720
);

@@ -250,0 +250,0 @@ };

@@ -13,5 +13,5 @@ /*

1,u=b.length,k,q;l<u;l++)if(k=b[l],c[k]){q=c[k](a.slice(g),b[0]);if(!q.length)break;g+=q.length;d[q.token||k.charAt(0)]=q.value;d._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}d.H=d.H||c.h12(d.h,d.A);d._index=g;d._length=a.length;return d};f.parse=function(a,b,c){var d=this||e;a=d.preparse(a,b);return d.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)};f.isValid=function(a,b){var c=this||e;a="string"===typeof a?c.preparse(a,b):a;c=[31,28+c.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>c||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)};f.transform=function(a,b,c,d){let h=this||e;return h.format(h.parse(a,b),c,d)};f.addYears=function(a,b){return(this||e).addMonths(a,
a.M,a.D,a.H,a.m,a.s,a.S)):new Date(NaN)};f.isValid=function(a,b){var c=this||e;a="string"===typeof a?c.preparse(a,b):a;c=[31,28+c.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>c||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,c,d){let h=this||e;return h.format(h.parse(a,b),c,d)};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,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 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}}};f.isLeapYear=function(a){return!(a%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]||{},c=n(t,b.res,!0);a=n(w,b.formatter,!0,
c);b=n(x,b.parser,!0,c);e._formatter=v._formatter=a;e._parser=v._parser=b;for(var d in m)e.extend(m[d]);return r};e.extend=function(a){var b=n(e._parser.res,a.res),c=a.extender||{};e._formatter=n(e._formatter,a.formatter,!1,b);e._parser=n(e._parser,a.parser,!1,b);for(var d in c)e[d]||(e[d]=c[d])};e.plugin=function(a){(a="function"===typeof a?a:e.plugin[a])&&e.extend(m[a(f,v)]||{})};return e})

@@ -241,3 +241,3 @@ /**

dt.H < 0 || dt.H > 23 || dt.m < 0 || dt.m > 59 || dt.s < 0 || dt.s > 59 || dt.S < 0 || dt.S > 999 ||
dt.Z < -720 || dt.Z > 840
dt.Z < -840 || dt.Z > 720
);

@@ -244,0 +244,0 @@ };

@@ -14,3 +14,3 @@ /*

d.A);d._index=g;d._length=a.length;return d};u.parse=function(a,b,c){var d=this||x;a=d.preparse(a,b);return d.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)};
u.isValid=function(a,b){var c=this||x;a="string"===typeof a?c.preparse(a,b):a;c=[31,28+c.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>c||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)};u.transform=function(a,b,c,d){let h=this||x;return h.format(h.parse(a,b),c,d)};u.addYears=function(a,b){return(this||x).addMonths(a,12*b)};
u.isValid=function(a,b){var c=this||x;a="string"===typeof a?c.preparse(a,b):a;c=[31,28+c.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>c||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,c,d){let h=this||x;return h.format(h.parse(a,b),c,d)};u.addYears=function(a,b){return(this||x).addMonths(a,12*b)};
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)};

@@ -17,0 +17,0 @@ u.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}}};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);

{
"name": "date-and-time",
"version": "2.1.1",
"version": "2.1.2",
"description": "A Minimalist DateTime utility for Node.js and the browser",

@@ -5,0 +5,0 @@ "main": "date-and-time.js",

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

- 2.1.2
- Fixed an issue that the lib's validation logic would condider an error when a timezone offset value of a datetime string was greater then +12 hours.
- 2.1.1

@@ -45,10 +48,2 @@ - Updated dev dependencies to resolve vulnerability.

- 2.0.1
- Fixed a bug that the timezone plugin does not support changing locales.
- 2.0.0
- Fixed a conflict when importing multiple plugins and locales.
- **Breaking Changes!** Due to the above fix, the specifications of plugin, locale, and extension have been changed. The `meridiem` plugin and the `two-digit-year` plugin are now partially incompatible with previous ones. See [here](./PLUGINS.md) for details. Also the `extend()` function has changed. If you are using it, check [here](./EXTEND.md) for any impact. The locales are still compatible.
- Added `timezone` plugin. You can now use the IANA timezone name to output a datetime string or input a date object. See [PLUGINS.md](./PLUGINS.md) for details.
## Usage

@@ -55,0 +50,0 @@

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