GothenburgBitFactory / timewarrior

Timewarrior - Commandline Time Tracking and Reporting
https://timewarrior.net
MIT License
1.27k stars 98 forks source link

[TI-15] Make weekstart configurable #23

Open taskwarrior opened 6 years ago

taskwarrior commented 6 years ago

Dirk Deimeke on 2016-06-26T07:08:15Z says:

Weekstart is handled differently across the world and calendar weeks as well.

taskwarrior commented 6 years ago

Migrated metadata:

Created: 2016-06-26T07:08:15Z
Modified: 2016-07-01T11:47:49Z
taskwarrior commented 6 years ago

Paul Beckingham on 2016-06-26T12:54:58Z says:

This is true, even though ISO-8601 says the week starts on Monday.

To support this, what needs to change? The 'week' report and ':week' hint only? The Week number would remain unaffected, I presume.

taskwarrior commented 6 years ago

Dirk Deimeke on 2016-06-26T18:34:57Z says:

task calendar shows me week 25, timew summary says week 27. task is correct.

And yes, I think, only the report and the hint need to be changed.

There are - as far as I know - two different measures to find the first week of the year. The most used is that the week with the 4th of January is the first week (or the first Thursday). If it is on Sunday, it is different for ISO and maybe the rest of the world. US calculates the week as first in which you find the 1st January, I think.

ddombrowsky commented 6 years ago

Being able to define the start of the timew week report would be help my United Statesian brain, yes :)

thanateros commented 5 years ago

At work, I use timewarrior to help me be accurate with my timesheets.

At my company, our work week starts on Sunday, not Monday, for our timesheet accounting.

It is a pain to keep manually putting in date ranges for the week report; it would be nice if perhaps there was a timew config command (or something to manually put in the config file) that would let the user customize when the beginning of the week is.

AlansCodeLog commented 5 years ago

Found this looking for if the start / end of the day could be configured as well as the week. I keep some weird hours and I don't like that blocks that go past midnight are part of the next day. It would be nice to be able to configure that as well.

Also, I couldn't find anything, maybe I missed it, but is it possible to just not show inactive/excluded hours? Ideally I would want something like this along the top: [start of day] [times in between] [end of day] [collapsed exclusion start - end].

lauft commented 5 years ago

@AlansCodeLog, your request is rather unusual, so I would rather outsource it to an extension than to implement it in the standard reports.

AlansCodeLog commented 5 years ago

Making the day start/end configurable or the second part? I get if the second part is too much, though I don't think it's unusual? I mean we all sleep right? But it was just a suggestion, I can live without. The un-configurable day start/end is more annoying.

ddombrowsky commented 5 years ago

@AlansCodeLog You can configure the hours of your workday using "exclusions" in ~/.timewarrior/timewarrior.cfg. But if you're asking if you can configure "Monday" to go until 5am "Tuesday", I can't imagine how that would even work.

I was just asking for the "week" report to go from sunday to saturday, but I also understand that is difficult since the week number is probably deeply embedded into the program, so shrug.

It works.

AlansCodeLog commented 5 years ago

@ddombrowsky Yes, I'm aware of the exclusions, but yeah, what I was looking for was some way for the day to end past midnight (and also start past midnight, there would be no overlap with the next day, just a shift), kind of like a localized time zone.

I think in the end though I'm going to look for something else, I really liked the integration with taskwarrior, but I just found out there's also no real multitasking either which is a deal breaker unfortunately.

lauft commented 5 years ago

@AlansCodeLog, a localized time zone is an interesting idea, but also - as with the regular timezones - in my opinion something that should be treated with extreme caution. :)

thw26 commented 1 year ago

Here is a bash workaround for needing Sunday to be the first day of the week. Add this to your .bashrc.

function timew {
    TIMEWARRIORDB="/PATH/TO/DB"; export TIMEWARRIORDB;
    LASTSUNDAY="$(date -dlast-sunday +%Y-%m-%dT00:00)"; export LASTSUNDAY;
    THISSATURDAY="$(date -dsaturday +%Y-%m-%dT23:59)"; export THISSATURDAY;
    if [ "$1" = "summary" ] && [ "$2" = "week" ]; then
        shift 2;
        timew summary "${LASTSUNDAY}" - "${THISSATURDAY}";
    else
        command timew "$@";
    fi
}
Hapi commented 1 year ago

Paul Beckingham on 2016-06-26T12:54:58Z says:

This is true, even though ISO-8601 says the week starts on Monday.

To support this, what needs to change? The 'week' report and ':week' hint only? The Week number would remain unaffected, I presume.

I would say that in addition to :week hint also :fortnight and :lastweek hints should be changed as well as all the date formats having week number in it, like 2023W28. Also, certain named days should changed too, like sow, eow, etc.

One option could be to add always one date data before the given start date for the extension mechanism. For example week 2023-W28 would insert 2023-07-09 as a first JSON while temp.report.start: would still be temp.report.start: 20230710T235959Z. This addition should most probably be configurable and told in the report with suitable temp.report variable. This would allow creating own weekly reports starting on Sundays.

But, of course, most convenient solution would be change hints, date formats and named dates.