@datatypes/moment
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -8,7 +8,4 @@ 'use strict'; | ||
exports.default = function (instant, duration) { | ||
(0, _assert2.default)(instant instanceof _Instant2.default, instant + ' is not an instance of class "Instant"'); | ||
(0, _assert2.default)(duration instanceof _duration2.default, duration + ' is not an instance of class "Duration"'); | ||
var clone = new _Instant2.default(instant); | ||
var clone = new _Instant2.default(instant.toJSON()); | ||
if (duration.milliseconds) { | ||
@@ -41,10 +38,2 @@ clone.setUTCMilliseconds(clone.getUTCMilliseconds() + duration.milliseconds); | ||
var _assert = require('assert'); | ||
var _assert2 = _interopRequireDefault(_assert); | ||
var _duration = require('@datatypes/duration'); | ||
var _duration2 = _interopRequireDefault(_duration); | ||
var _Instant = require('./classes/Instant'); | ||
@@ -51,0 +40,0 @@ |
@@ -55,3 +55,3 @@ 'use strict'; | ||
if (arguments.length === 1) { | ||
arguments[0] = String(arguments[0]); | ||
arguments[0] = typeof arguments[0].toISOString === 'function' ? arguments[0].toISOString() : String(arguments[0]); | ||
@@ -62,9 +62,8 @@ // Correctly handle moments larger than a decade | ||
} | ||
// 2015-11-24T21 => 2015-11-24T21:00Z | ||
else if (/^\d{4}(-\d{2}){2}T\d{2}Z?$/i.test(arguments[0])) { | ||
arguments[0] = arguments[0].replace(/Z?$/i, ':00Z'); | ||
} | ||
} | ||
// 2015-11-24T21 => 2015-11-24T21:00Z | ||
if (/^\d{4}(-\d{2}){2}T\d{2}Z?$/i.test(arguments[0])) { | ||
arguments[0] = arguments[0].replace(/Z?$/i, ':00Z'); | ||
} | ||
return _possibleConstructorReturn(this, (Instant.__proto__ || Object.getPrototypeOf(Instant)).apply(this, arguments)); | ||
@@ -78,2 +77,7 @@ } | ||
} | ||
}, { | ||
key: 'clone', | ||
value: function clone() { | ||
return new Instant(String(this)); | ||
} | ||
}]); | ||
@@ -80,0 +84,0 @@ |
@@ -43,3 +43,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, (Millisecond.__proto__ || Object.getPrototypeOf(Millisecond)).call(this, fragments.join('.'))); | ||
var _this = _possibleConstructorReturn(this, (Millisecond.__proto__ || Object.getPrototypeOf(Millisecond)).call(this, fragments[0])); | ||
@@ -46,0 +46,0 @@ (0, _assert2.default)(0 <= millisecond && millisecond < 1000, // eslint-disable-line yoda |
@@ -8,7 +8,4 @@ 'use strict'; | ||
exports.default = function (instant, duration) { | ||
(0, _assert2.default)(instant instanceof _Instant2.default, instant + ' is not an instance of class "Instant"'); | ||
(0, _assert2.default)(duration instanceof _duration2.default, duration + ' is not an instance of class "Duration"'); | ||
var clone = new _Instant2.default(instant); | ||
var clone = new _Instant2.default(instant.toJSON()); | ||
if (duration.milliseconds) { | ||
@@ -42,10 +39,2 @@ clone.setUTCMilliseconds(clone.getUTCMilliseconds() - duration.milliseconds); | ||
var _assert = require('assert'); | ||
var _assert2 = _interopRequireDefault(_assert); | ||
var _duration = require('@datatypes/duration'); | ||
var _duration2 = _interopRequireDefault(_duration); | ||
var _Instant = require('./classes/Instant'); | ||
@@ -52,0 +41,0 @@ |
{ | ||
"name": "@datatypes/moment", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "ISO 8601 based time and date module", | ||
@@ -5,0 +5,0 @@ "main": "build/index", |
@@ -13,3 +13,3 @@ import runTest from 'ava' | ||
lowerLimit: new Instant(test.title), | ||
upperLimit: new Instant('2015-11-24T21:15:42.124'), | ||
upperLimit: new Instant('2015-11-24T21:15:42.124Z'), | ||
} | ||
@@ -25,4 +25,4 @@ | ||
string: '2015-11-24T21:15:42.123Z', | ||
lowerLimit: new Instant('2015-11-24T21:15:42.123'), | ||
upperLimit: new Instant('2015-11-24T21:15:42.124'), | ||
lowerLimit: new Instant('2015-11-24T21:15:42.123Z'), | ||
upperLimit: new Instant('2015-11-24T21:15:42.124Z'), | ||
} | ||
@@ -29,0 +29,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
94259
2105