Skip to content

Commit

Permalink
Updated function name to len(). The ndays() function from internals.r…
Browse files Browse the repository at this point in the history
…s seems to be for testing purposes so I left it alone but updated the equation. Every 4th year is a leap year, except for if it is the first year of a century, except-except every 400 years
  • Loading branch information
DanielPoprawski committed Dec 21, 2024
1 parent 323737a commit 66b709e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/month.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl Month {
}

/// Get the length of the month in a given year
pub const fn length(&self, year: i32) -> u8 {
pub const fn len(&self, year: i32) -> u8 {
match *self {

Check warning on line 167 in src/month.rs

View check run for this annotation

Codecov / codecov/patch

src/month.rs#L166-L167

Added lines #L166 - L167 were not covered by tests
Month::January
| Month::March
Expand All @@ -173,7 +173,7 @@ impl Month {
| Month::October
| Month::December => 31,
Month::April | Month::June | Month::September | Month::November => 30,
Month::February if year % 4 == 0 && (year % 25 != 0 || year % 16 == 0) => 29,
Month::February if (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0) => 29,
Month::February => 28,

Check warning on line 177 in src/month.rs

View check run for this annotation

Codecov / codecov/patch

src/month.rs#L174-L177

Added lines #L174 - L177 were not covered by tests
}
}

Check warning on line 179 in src/month.rs

View check run for this annotation

Codecov / codecov/patch

src/month.rs#L179

Added line #L179 was not covered by tests
Expand Down

0 comments on commit 66b709e

Please sign in to comment.