Fixed empty space being added for the first day of the heatmap if its also first day of the month

master
Wynd 2024-11-02 15:47:19 +02:00
parent 267e361849
commit c5341996f8
1 changed files with 8 additions and 3 deletions

View File

@ -55,15 +55,20 @@ impl Heatmap {
}
}
// Track the very first day of the heatmap, as we don't want the extra spacing in front of
// those.
let mut first_day = true;
while current_day <= until {
if split_months {
// If current day is the first of the month we add 2 weeks worth of empty space so
// months are more visible
if current_day.day0() == 0 {
// If current day is the first of the month, but not the first day of the heatmap
// we add 2 weeks worth of empty space so months are more visible
if !first_day && current_day.day0() == 0 {
for i in 0..14 {
heatmap.data[(i as usize) % 7].push(-1);
}
}
first_day = false;
}
let month_name = current_day.format("%b").to_string();