GothenburgBitFactory / GothenburgBitFactory/timewarrior

Configure day end/start time for "timew summary"

Open
#453 1 comment 2 reactions 0 assignees View on GitHub
discussion
Dominant language
C++
Stars
1.7k
Forks
117
Avg merge
1d 7h
Merged PRs (30d)
5

Description

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 `, 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 `, 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;`)

[CmdSummary.cpp.zip](https://github.com/GothenburgBitFactory/timewarrior/files/7292375/CmdSummary.cpp.zip)

Also -- sorry, first time actually posting code on other projects on GitHub. Hope this was the proper channel.

Contributor guide

Open the contributing guide

Research direction

Start with CmdSummary, which the issue identifies as the modified entry point, and review the linked discussion and the provided hack. Trace how summary filters are handled through the CLI, especially the noted breakage with `timew summary `. Done means a configurable day boundary changes `timew summary` output without affecting day/week/month or filtered summaries.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.