This commit is contained in:
Miraty 2024-03-15 11:56:14 +01:00
parent d3ec9ef5a0
commit 63bc728ec5
2 changed files with 10 additions and 10 deletions

View File

@ -16,7 +16,7 @@ pub mod libstardit {
_ => panic!("Incorrect timestamp_millis"),
};
let day = date.ordinal() as u16;
return StarDIT {
StarDIT {
year: (date.year() + 10000) as u16,
weekade: day / 10,
day_name: match day % 10 {
@ -33,7 +33,7 @@ pub mod libstardit {
_ => "?",
}
.to_string(),
day: day,
};
day,
}
}
}

View File

@ -34,23 +34,23 @@ fn main() {
let mut day_i: u16 = 1;
while day_i <= day_stop {
if day_i % 10 == 0 {
print!("\n");
println!();
if day_i / 10 == stardit.day / 10 {
print!("\x1b[1m{}\x1b[0m ", format!("{: >3}", day_i / 10));
print!("\x1b[1m{: >3}\x1b[0m ", day_i / 10);
} else {
print!("{} ", format!("{: >3}", day_i / 10));
print!("{: >3} ", day_i / 10);
}
}
if day_i == stardit.day {
print!("\x1b[7m{}\x1b[0m ", format!("{: >3}", day_i));
print!("\x1b[7m{: >3}\x1b[0m ", day_i);
} else {
print!("{} ", format!("{: >3}", day_i));
print!("{: >3} ", day_i);
}
day_i += 1;
}
print!("\n");
println!();
}
fn is_leap_year(year: i32) -> bool {
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
}