work-week ends do not seem to be calculated correctly

Open
#49 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Reproduce the reported commands through the task calc entry point in libshared, using the stated reference date and work-week expressions. Trace the work-week start and end calculations, then verify that each result keeps the Sunday in its current Monday–Sunday week and that start dates precede end dates.

Written by the indexing model from the issue text.

Description

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)

Dominant language
C++
Stars
7
Forks
30
Avg merge
13h 17m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GothenburgBitFactory/libshared

All issues in GothenburgBitFactory/libshared

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.