Skip to content

Commit

Permalink
Bracket today in the output.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanwentao committed Apr 14, 2024
1 parent 2f5d6ad commit 0dd430a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "omnical"
version = "0.10.5"
version = "0.10.6"
edition = "2021"
description = "Print calendars, convert dates, and more."
license = "MIT"
Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ fn print_year(year: GregorianYear) {
}

fn print_month(month: GregorianMonth) {
let today: GregorianDay = Date::from_unix_time_with_tz(unix_time_now(), 8.0).into();
for weekday in Weekday::VARIANTS {
print!(" {:3}", weekday);
}
Expand All @@ -128,7 +129,11 @@ fn print_month(month: GregorianMonth) {
print!(" ");
}
for day in days {
print!("{:>4}", day.ord());
if day == today {
print!("[{:>2}]", day.ord());
} else {
print!(" {:>2} ", day.ord());
}
if day.weekday() == Weekday::last() {
println!();
}
Expand Down

0 comments on commit 0dd430a

Please sign in to comment.