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

Bug: Empty day trailing day with a different first weekday #32

Closed
scriptingstudio opened this issue Mar 2, 2022 · 5 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@scriptingstudio
Copy link

scriptingstudio commented Mar 2, 2022

If the first weekday is Monday the Sunday of the next month will by empty.

February

image

Yellow square is the day of the next month. Why is it highlighted? It is a different month.

March

image

image

April

image

@jdhitsolutions
Copy link
Owner

I can duplicate this when setting the first day of the week to Monday.

image

This appears to be the case with any month where the first day is Monday.

@jdhitsolutions jdhitsolutions added the bug Something isn't working label Mar 2, 2022
@jdhitsolutions jdhitsolutions changed the title Empty day Bug: Empty day trailing day with a different first weekday Mar 2, 2022
@jdhitsolutions jdhitsolutions self-assigned this Mar 2, 2022
@scriptingstudio
Copy link
Author

_getCalendar function: insert the snippet after line 82 and check it out

if ($fd) {
    $day0 += [datetime]$currentDay
}

@scriptingstudio
Copy link
Author

scriptingstudio commented Mar 3, 2022

Also, small optimization for block of 118-148 lines

$underline = 4 #$abbreviated[0].Length + 1 (3 or 4)
$days = [System.Collections.Generic.List[string]]::new()
$addday = {
    $d = $abbreviated[$args[0]].padleft($underline, " ")
    if ($NoANSI) {
        $days.add($d)
    } else {
        $days.add(("{0}{1}{2}" -f $PScalendarConfiguration.DayofWeek, $d, "$esc[0m"))
    }
}
$n = if ($fd -eq 0) {0} else {1}
for ($n; $n -lt $abbreviated.count; $n++) {. $addday $n}
if ($fd) {. $addday 0}

$underline usage:
line 176: $value = $d.tostring().padleft($underline, ' ')
line 197: [int]$pad = (10*$underline - $plainhead.Length) / 2 + 1

@jdhitsolutions
Copy link
Owner

Thanks for the suggestions. Fixed the missing day problem. Working on other issues for the next release.

@jdhitsolutions
Copy link
Owner

Added in v2.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants