mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: added day/month/year format (#2189)
This commit is contained in:
@ -58,6 +58,16 @@ mod tests {
|
||||
&field_rev,
|
||||
);
|
||||
},
|
||||
DateFormat::DayMonthYear => {
|
||||
assert_date(
|
||||
&type_option,
|
||||
1647251762,
|
||||
None,
|
||||
"14/03/2022",
|
||||
false,
|
||||
&field_rev,
|
||||
);
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -174,6 +174,7 @@ pub enum DateFormat {
|
||||
US = 1,
|
||||
ISO = 2,
|
||||
Friendly = 3,
|
||||
DayMonthYear = 4,
|
||||
}
|
||||
impl std::default::Default for DateFormat {
|
||||
fn default() -> Self {
|
||||
@ -188,6 +189,7 @@ impl std::convert::From<i32> for DateFormat {
|
||||
1 => DateFormat::US,
|
||||
2 => DateFormat::ISO,
|
||||
3 => DateFormat::Friendly,
|
||||
4 => DateFormat::DayMonthYear,
|
||||
_ => {
|
||||
tracing::error!("Unsupported date format, fallback to friendly");
|
||||
DateFormat::Friendly
|
||||
@ -207,6 +209,7 @@ impl DateFormat {
|
||||
DateFormat::US => "%Y/%m/%d",
|
||||
DateFormat::ISO => "%Y-%m-%d",
|
||||
DateFormat::Friendly => "%b %d,%Y",
|
||||
DateFormat::DayMonthYear => "%d/%m/%Y",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user