Impl Display for DiaryId
This commit is contained in:
parent
de9d933a6b
commit
b68bd7ef8e
1 changed files with 10 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
use std::convert::Into;
|
||||
use std::fmt::{Display, Formatter, Error as FmtError};
|
||||
|
||||
use chrono::naive::datetime::NaiveDateTime;
|
||||
use chrono::naive::time::NaiveTime;
|
||||
|
@ -133,6 +134,15 @@ impl Into<String> for DiaryId {
|
|||
|
||||
}
|
||||
|
||||
impl Display for DiaryId {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
|
||||
write!(fmt, "{}/{:0>4}/{:0>2}/{:0>2}/{:0>2}:{:0>2}",
|
||||
self.name, self.year, self.month, self.day, self.hour, self.minute)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Into<NaiveDateTime> for DiaryId {
|
||||
|
||||
fn into(self) -> NaiveDateTime {
|
||||
|
|
Loading…
Reference in a new issue