const timetrack = require('./timetrack');
const calculateDuration = require('./calculateDuration');

module.exports = (pluginContext) => {
    return (project, env = {}) => {
        return new Promise((resolve, reject) => {
            timetrack.loadData();
            resolve(timetrack.getHistory().map(entry => {
                // get the duration of the entry
                let duration = 'Running';
                if ('stop' in entry) {
                    duration = calculateDuration(entry.start, entry.stop);
                }

                // get the project name
                const project = entry.project || 'No project';

                return {
                    icon: 'fa-clock-o',
                    title: `[${duration}] ${project}`,
                    subtitle: `Nice work bro!`
                }
            }));
        });
    }
}

@@ -35,16 +35,53 @@
 rack');%0A
+const Sugar = require('sugar-date');%0A
 const ca
@@ -343,24 +343,46 @@
 (entry =%3E %7B%0A
+                try %7B%0A
             
@@ -523,36 +523,163 @@
     
-duration = calculateDuration
+// sugarjs sets it auto on 1 hour, so i'll just subtract 3600000 for now, fix this later%0A                    duration = Sugar.Date.format(Sugar.Date.create
 (ent
@@ -687,12 +687,12 @@
 y.st
-art,
+op -
  ent
@@ -696,18 +696,42 @@
 entry.st
-op
+art - 3600000), '%25H:%25M:%25S'
 );%0A     
@@ -848,16 +848,145 @@
 ject';%0A%0A
+                // get the start date%0A                const startDate = Sugar.Date.format(Sugar.Date.create(entry.start), '%25c')%0A%0A
         
@@ -1132,23 +1132,122 @@
 e: %60
-Nice work bro!%60
+started on $%7BstartDate%7D%60%0A                %7D%0A                %7D catch (e) %7B%0A                    alert('fount: ' + e);
 %0A   

Use sugarjs for date parsing