New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@datatypes/moment

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datatypes/moment - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

build/endOf.js

4

build/classes/Day.js

@@ -40,3 +40,3 @@ 'use strict';

console.assert(1 <= day && day <= 31);
console.assert(1 <= day && day <= 31, 'Day must be in range [1,31] and not ' + day);
_this._day = day;

@@ -65,4 +65,4 @@ return _this;

set: function set(day) {
delete this._isoString;
this._day = day;
this._isoString = null;
return this;

@@ -69,0 +69,0 @@ },

@@ -33,3 +33,3 @@ 'use strict';

var pattern = /T([01][0-9]|2[0-4])(?:\.([0-9]+))?Z?$/i;
var pattern = /T([01][0-9]|2[0-4])(\.[0-9]+)?Z?$/i;
var matches = isoString.match(pattern);

@@ -41,4 +41,4 @@

var hour = matches[1];
var hourFraction = matches[2];
var hour = Number(matches[1]);
var hourFraction = Number('0' + matches[2]);

@@ -70,4 +70,4 @@ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Hour).call(this, isoString.replace(pattern, '')));

set: function set(hour) {
delete this._isoString;
this._hour = hour;
this._isoString = null;
return this;

@@ -74,0 +74,0 @@ },

@@ -65,4 +65,4 @@ 'use strict';

set: function set(millisecond) {
delete this._isoString;
this._millisecond = millisecond;
this._isoString = null;
return this;

@@ -69,0 +69,0 @@ },

@@ -33,3 +33,3 @@ 'use strict';

var pattern = /:?([0-5][0-9])(?:\.([0-9]+))?Z?$/i;
var pattern = /:?([0-5][0-9])(\.[0-9]+)?Z?$/i;
var matches = isoString.match(pattern);

@@ -41,4 +41,4 @@

var minute = matches[1];
var minuteFraction = matches[2];
var minute = Number(matches[1]);
var minuteFraction = Number('0' + matches[2]);

@@ -70,4 +70,4 @@ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Minute).call(this, isoString.replace(pattern, '')));

set: function set(minute) {
delete this._isoString;
this._minute = minute;
this._isoString = null;
return this;

@@ -74,0 +74,0 @@ },

@@ -100,5 +100,15 @@ 'use strict';

}, {
key: 'startsSimultaneous',
value: function startsSimultaneous(moment) {
return +moment.lowerLimit === +this.lowerLimit;
}
}, {
key: 'endsSimultaneous',
value: function endsSimultaneous(moment) {
return +moment.upperLimit === +this.upperLimit;
}
}, {
key: 'isSimultaneous',
value: function isSimultaneous(moment) {
return +moment.lowerLimit === +this.lowerLimit && +moment.upperLimit === +this.upperLimit;
return this.startsSimultaneous(moment) && this.endsSimultaneous(moment);
}

@@ -121,18 +131,2 @@ }, {

}, {
key: 'lowerLimit',
get: function get() {
return new _Instant2.default(this.string);
},
set: function set(lowerLimit) {
this._lowerLimit = lowerLimit;
}
}, {
key: 'upperLimit',
get: function get() {
return (0, _addDurationToInstant2.default)(this.lowerLimit, (0, _precisionToDuration2.default)(this.constructor.name));
},
set: function set(upperLimit) {
this._upperLimit = upperLimit;
}
}, {
key: 'string',

@@ -170,2 +164,12 @@ get: function get() {

}
}, {
key: 'lowerLimit',
get: function get() {
return new _Instant2.default(this.string);
}
}, {
key: 'upperLimit',
get: function get() {
return (0, _addDurationToInstant2.default)(this.lowerLimit, (0, _precisionToDuration2.default)(this.constructor.name));
}
}]);

@@ -172,0 +176,0 @@

@@ -48,3 +48,3 @@ 'use strict';

console.assert(1 <= month && month <= 12);
console.assert(1 <= month && month <= 12, 'Month must be in range [1,12] and not ' + month);
_this._month = month;

@@ -68,4 +68,4 @@ return _this;

set: function set(month) {
delete this._isoString;
this._month = month;
this._isoString = null;
return this;

@@ -72,0 +72,0 @@ },

@@ -33,3 +33,3 @@ 'use strict';

var pattern = /:?([0-9]{2})(?:\.([0-9]+))?Z?$/i;
var pattern = /:?([0-9]{2})(\.[0-9]+)?Z?$/i;
var matches = isoString.match(pattern);

@@ -41,4 +41,4 @@

var second = matches[1];
var secondFraction = matches[2];
var second = Number(matches[1]);
var secondFraction = Number('0' + matches[2]);

@@ -71,4 +71,4 @@ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Second).call(this, isoString.replace(pattern, '')));

set: function set(second) {
delete this._isoString;
this._second = second;
this._isoString = null;
return this;

@@ -75,0 +75,0 @@ },

@@ -34,3 +34,3 @@ 'use strict';

year = Number(year);
console.assert(0 <= year && year <= 9999);
console.assert(0 <= year && year <= 9999, 'Year must be in range [0,9999] and not ' + year);
_this._year = year;

@@ -54,5 +54,4 @@ return _this;

set: function set(year) {
delete this._isoString;
this._year = year;
this._yearString = null;
this._isoString = null;
return this;

@@ -59,0 +58,0 @@ },

@@ -39,2 +39,3 @@ "use strict";

object.millisecond = 0;
delete object._isoString;
}
{
"name": "@datatypes/moment",
"version": "0.5.0",
"version": "0.6.0",
"description": "ISO 8601 based time and date module",

@@ -23,3 +23,3 @@ "main": "build/index",

"devDependencies": {
"ava": "^0.12.0",
"ava": "^0.13.0",
"babel-cli": "^6.6.5",

@@ -43,4 +43,5 @@ "babel-plugin-syntax-trailing-function-commas": "^6.5.0",

"@datatypes/duration": "^0.4.0",
"month-days": "^1.0.0",
"zpad": "^0.5.0"
}
}

@@ -35,2 +35,18 @@ import runTest from 'ava'

runTest('check if moment starts simultaneous with another moment', test => {
const moment1 = momentFromString('2015-11-01')
const moment2 = momentFromString('2015-11')
expect(moment1.startsSimultaneous(moment2), 'to be true')
})
runTest('check if moment ends simultaneous with another moment', test => {
const moment1 = momentFromString('2015-11-30')
const moment2 = momentFromString('2015-11')
expect(moment1.endsSimultaneous(moment2), 'to be true')
})
runTest('check if moment is simultaneous to another moment', test => {

@@ -37,0 +53,0 @@ const moment1 = momentFromString('2015-11-25')

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