Skip to content

work-week ends do not seem to be calculated correctly #49

@smemsh

Description

@smemsh

Work week endings may be calculated incorrectly. Observe the following:

$ for ww in {s,e}o{,p,n}ww
  do printf "%s\t%s\n" $ww $(
      faketime '2017-03-05 12:34:56' task calc $ww
  ); done

soww    2017-03-13T00:00:00
sopww   2017-02-27T00:00:00
sonww   2017-03-13T00:00:00
eoww    2017-03-10T23:59:59
eopww   2017-03-03T23:59:59
eonww   2017-03-17T23:59:59

with the reference date of 2017-03-05 12:34:56 (a Sunday), and the calendar:

 $ ncal 03 2017
    March 2017        
Mo     6 13 20 27   
Tu     7 14 21 28   
We  1  8 15 22 29   
Th  2  9 16 23 30   
Fr  3 10 17 24 31   
Sa  4 11 18 25      
Su  5 12 19 26      
    9 10 11 12 13   

these do not look right:

  • It seems to consider the next "work week" to have already begun on Saturday, but I should think the next work week doesn't actually begin until Monday. Even though there's no actual work days left, it's still within the same work week.
  • soww and sonww are identical
  • eoww is earlier than soww (!)

This issue was noticed during testing for #47 (a change to comments documenting behavior of eo*) and is forked into a standalone issue as per the discussion there.

(test version of libshared was 591fa58)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions