This repository was archived by the owner on May 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const Time = require('./time');
77const regex = / a d d e d ( .* ) o f t i m e s p e n t / i;
88const subRegex = / s u b t r a c t e d ( .* ) o f t i m e s p e n t / i;
99const removeRegex = / R e m o v e d t i m e s p e n t / i;
10+ const dateRegex = / s p e n t a t ( .* ) / i;
1011
1112/**
1213 * base model for models that have times
@@ -68,8 +69,9 @@ class hasTimes extends Base {
6869 } ) ;
6970
7071 let promise = this . parallel ( this . notes , ( note , done ) => {
71- let created = moment ( note . created_at ) , match , subMatch ;
72-
72+ let dateMatch = dateRegex . exec ( note . body ) ;
73+ let created = moment ( dateMatch ? dateMatch [ 1 ] : note . created_at ) ;
74+ let match , subMatch ;
7375
7476 if ( //
7577 // filter out user notes
@@ -80,6 +82,7 @@ class hasTimes extends Base {
8082
8183 // create a time string and a time object
8284 let timeString = match ? match [ 1 ] : ( subMatch ? `-${ subMatch [ 1 ] } ` : `-${ Time . toHumanReadable ( timeSpent , this . config . get ( 'hoursPerDay' ) ) } ` ) ;
85+ if ( dateMatch ) note . created_at = dateMatch [ 1 ] ;
8386 let time = new Time ( timeString , note , this , this . config ) ;
8487
8588 // add to total time spent
You can’t perform that action at this time.
0 commit comments