Comparing version 1.10.5 to 1.11.0
@@ -11,2 +11,3 @@ #!/usr/bin/env node | ||
var stringify = require('json-stable-stringify'); | ||
var parseTime = require('parse-messy-time'); | ||
var os = require('os'); | ||
@@ -78,7 +79,7 @@ var tmpdir = (os.tmpdir || os.tmpDir)(); | ||
var type = argv.type; | ||
var value = { type: type, message: message, end: end }; | ||
var pkey = 'time!' + start; | ||
var tkey = 'time-type!' + type + '!' + start; | ||
db.batch([ | ||
@@ -111,3 +112,3 @@ { type: 'put', key: pkey, value: value }, | ||
var title = argv.title || 'consulting'; | ||
var s = db.createReadStream({ | ||
@@ -136,3 +137,3 @@ gt: 'time!' + (argv.gt || ''), | ||
nextDay.setMilliseconds(0); | ||
acc = reducer(acc, { | ||
@@ -154,3 +155,3 @@ key: 'time!' + strftime('%F %T', nextDay), | ||
}, {}); | ||
console.log(stringify([ { | ||
@@ -182,7 +183,7 @@ title: title, | ||
if (argv.type && isRegExp(argv.type) && !testRegExp(argv.type, row.value.type)) return; | ||
var start = new Date(row.key.split('!')[1]); | ||
var end = row.value.end && new Date(row.value.end); | ||
var elapsed = (end ? end : new Date) - start; | ||
console.log('%s,%s,%s,%s,%s,%s,"%s","%s"', | ||
@@ -212,7 +213,7 @@ toStamp(row.key), | ||
var start = new Date(row.key.split('!')[1]); | ||
var end = row.value.end && new Date(row.value.end); | ||
var elapsed = (end ? end : new Date) - start; | ||
console.log( | ||
@@ -278,3 +279,3 @@ '%s %s [ %s - %s ] (%s)%s%s', | ||
var prop = argv._[2]; | ||
db.get(key, function (err, row) { | ||
@@ -327,3 +328,3 @@ if (err) return error(err); | ||
if (argv.type && row.value.type !== argv.type) return; | ||
row.value.archive = value; | ||
@@ -387,3 +388,3 @@ db.put(row.key, row.value, error); | ||
} | ||
if (prop === 'end') { | ||
@@ -400,3 +401,3 @@ db.get(key, function (err, row) { | ||
var newKey = 'time!' + updateDate(key, value, key.split('!')[1]); | ||
db.batch([ | ||
@@ -413,3 +414,3 @@ { type: 'put', key: newKey, value: row }, | ||
row.type = value; | ||
db.batch([ | ||
db.batch([ | ||
prevType && { type: 'del', key: prevType }, | ||
@@ -453,3 +454,3 @@ { type: 'put', key: key, value: row } | ||
function updateDate (key, value, old) { | ||
var d = new Date(value); | ||
var d = parseTime(value); | ||
if (isNaN(d.valueOf())) { | ||
@@ -456,0 +457,0 @@ if (!old || isNaN(old)) { |
@@ -42,2 +42,3 @@ usage: | ||
or clock at STAMP. | ||
Time stamp boundaries are parsed, like '20:11' or '10 minutes ago'. | ||
@@ -44,0 +45,0 @@ clocker edit STAMP {KEY} |
{ | ||
"name": "clocker", | ||
"version": "1.10.5", | ||
"version": "1.11.0", | ||
"description": "track project hours", | ||
@@ -14,2 +14,3 @@ "bin": { | ||
"mkdirp": "^0.3.5", | ||
"parse-messy-time": "^1.2.1", | ||
"strftime": "~0.6.2", | ||
@@ -16,0 +17,0 @@ "through": "^2.3.7" |
Sorry, the diff of this file is not supported yet
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
20670
424
139
8
+ Addedparse-messy-time@^1.2.1
+ Addedparse-messy-time@1.2.4(transitive)