Configure day end/start time for "timew summary"
I would like to propose a feature as seen in ATracker on iOS. If day start time is configured to be 5am, timew summary will split days at that time, instead of at 12am. For example, if run at 3am, it will display yesterday's 5am-12am and today's 12am-3am. If run at 2pm, it will display today's 5am-2pm. This does not affect timew day/week/month.
I have created a hack for this (for v1.4.3) as shown in the below link by modifying CmdSummary, but this will break timew summary <filter>, which is why I have not created a PR. Regardless, it works well for timew summary without any parameters:
~ % timew summary (It's 2:44am for me currently)
Wk Date Day Tags Start End Time Total
W40 2021-10-09 Sat work 5:00:00 5:45:28 0:45:28
sleep 5:45:28 13:15:38 7:30:10
lazy 13:15:38 13:36:12 0:20:34
body 13:36:12 15:11:44 1:35:32
lazy 15:11:44 15:59:02 0:47:18
body 15:59:02 16:20:58 0:21:56
work 16:20:58 17:19:38 0:58:40
school 17:19:38 20:20:10 3:00:32
work 20:20:10 21:26:40 1:06:30
body 21:26:40 22:00:00 0:33:20
fun 22:00:00 0:00:00 2:00:00 19:00:00
W40 2021-10-10 Sun fun 0:00:00 0:46:41 0:46:41
body 0:46:41 1:01:45 0:15:04
lazy 1:01:45 1:10:04 0:08:19
body 1:10:04 1:25:06 0:15:02
school 1:25:06 - 1:18:04 2:43:10
21:43:10
Quite useful for late sleepers such as myself!
Discussed in https://github.com/GothenburgBitFactory/timewarrior/discussions/452
Originally posted by limdingwen October 6, 2021 Hi, as a frequent late sleeper, I enjoyed a ATracker (iOS)'s setting that allowed me to configure when the day starts.
I've created a quick hack for timew-1.4.3 to implement this functionality into timew summary, so that if I run the command at maybe 3am, it will show the previous day's summary (5am to 12am) and the current day's summary (12am to current time), instead of a new day. If run at let's say 10am, it will display the current day's summary from 5am to current time.
This hack will break timew summary <filter>, it only works properly if there is no filter specified. I was unable to find a way to check if the filter was specified from CLI.cpp. Regardless, for those who do not need that functionality, I hope this is useful.
You can configure when the day starts on line 50. (int dayStartHour = 5;)
Also -- sorry, first time actually posting code on other projects on GitHub. Hope this was the proper channel.
I'm not sure how straightforward this would be, but it might be more straightforward to add this functionality as an extension / report?
This way you can have your time shifted summary printed any way that makes sense for you. For example, I have a report that formats the records in a format that simplifies entry into the time tracking system my former company used.