Bugfix - #11
Also changed expiration date to show "Never" instead of unix epoch in the pasta list, and renamed a few variables in animalnumbers.rs to make the function more readable.
This commit is contained in:
parent
9e4940eb44
commit
cd2eea30ce
3 changed files with 30 additions and 28 deletions
22
src/pasta.rs
22
src/pasta.rs
|
@ -32,15 +32,19 @@ impl Pasta {
|
|||
}
|
||||
|
||||
pub fn expiration_as_string(&self) -> String {
|
||||
let date =
|
||||
DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(self.expiration, 0), Utc);
|
||||
format!(
|
||||
"{:02}-{:02} {}:{}",
|
||||
date.month(),
|
||||
date.day(),
|
||||
date.hour(),
|
||||
date.minute(),
|
||||
)
|
||||
if self.expiration == 0 {
|
||||
String::from("Never")
|
||||
} else {
|
||||
let date =
|
||||
DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(self.expiration, 0), Utc);
|
||||
format!(
|
||||
"{:02}-{:02} {}:{}",
|
||||
date.month(),
|
||||
date.day(),
|
||||
date.hour(),
|
||||
date.minute(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue