Comparing version 1.16.6 to 1.16.7
@@ -380,4 +380,4 @@ const toStamp = require('./util').toStamp | ||
try { | ||
var startDate = getDate(start) | ||
value.end = getDate(end) | ||
var from = strftime('%F %T', getDate(start)) | ||
} catch (err) { | ||
@@ -387,2 +387,7 @@ return cb(err) | ||
if (value.end < startDate) { | ||
return cb(new Error(`Start date ${start} is greater than end date ${end}.`)) | ||
} | ||
var from = strftime('%F %T', startDate) | ||
var type = value.type | ||
@@ -389,0 +394,0 @@ var pkey = 'time!' + from |
{ | ||
"name": "clocker", | ||
"version": "1.16.6", | ||
"version": "1.16.7", | ||
"description": "track project hours", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -680,3 +680,3 @@ const test = require('tape') | ||
test('add', function (t) { | ||
t.plan(3) | ||
t.plan(4) | ||
@@ -723,5 +723,4 @@ t.test('Date arguments', function (t) { | ||
} | ||
var end = new Date('2018-01-01') | ||
clocker.add('2 hours ago', end, data, function (err, stamp) { | ||
clocker.add('yesterday 1:00', '2 minutes ago', data, function (err, stamp) { | ||
t.notOk(err) | ||
@@ -732,3 +731,3 @@ t.ok(stamp) | ||
t.notOk(err) | ||
t.deepEqual(data2, mockup(stamp, data, { end: end })) | ||
t.deepEqual(data2, mockup(stamp, data, { end: data2.end })) | ||
@@ -741,2 +740,14 @@ clocker.close(function () { | ||
}) | ||
t.test('error for end < start', function (t) { | ||
var clocker = initializeClocker() | ||
clocker.add('02:00', '01:00', function (err) { | ||
t.ok(err) | ||
clocker.close(function () { | ||
t.end() | ||
}) | ||
}) | ||
}) | ||
}) | ||
@@ -743,0 +754,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120701
2130