Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What if first provided date isn't working day? #7

Open
olorin37 opened this issue Oct 20, 2020 · 1 comment
Open

What if first provided date isn't working day? #7

olorin37 opened this issue Oct 20, 2020 · 1 comment

Comments

@olorin37
Copy link

If I understand correctly purpose of the function. It should always returns working days. So now programmer is forced to provide working day as the first one of the range to get correct answer.

User can workaround it by

# taking the first working day counting from "today" 
my $first-woking-day = $cal.workdays-away(Date.today - 1, 1);

# This should work already:
my $first-working-day = $cal.workdays-away(Date.today, 0);

Problematic line:

return $start if $days == 0;

@olorin37
Copy link
Author

Another example how it doesn't work (here in case of Workdate class):

# 2020-10-17 is Saturday, and we get:
❯ raku -e 'use Date::WorkdayCalendar; Workdate.new(Date.new("2020-10-17")).say'
2020-10-17

# With WA applied:
❯ raku -e 'use Date::WorkdayCalendar; Workdate.new(Date.new("2020-10-17") -1 ).succ.say'
2020-10-19

@lizmat lizmat changed the title What if fist provided date isn't working day? What if first provided date isn't working day? May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant