Fix error introduced in previous commit, where days in month was not

being updated while creating a DateTime struct from a u64 timestamp
This commit is contained in:
Nathan Fisher 2023-06-26 12:47:55 -04:00
parent af49f327ec
commit 68cccc840b

View file

@ -172,10 +172,12 @@ impl From<u64> for DateTime {
} }
} }
let mut month = 1; let mut month = 1;
let m_days = u64::from(days_in_month(month, year)); let mut m_days = u64::from(days_in_month(month, year));
while m_days <= days { while m_days <= days {
println!("Days in month {month}: {m_days}");
days -= m_days; days -= m_days;
month += 1; month += 1;
m_days = u64::from(days_in_month(month, year));
} }
let seconds = ts % SECS_PER_DAY; let seconds = ts % SECS_PER_DAY;
let minutes = seconds / 60; let minutes = seconds / 60;