Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
feat: added day/month/year format (#2189)
Samiksha Garg28ae193002fe
diff --git a/frontend/appflowy_flutter/assets/translations/en.json b/frontend/appflowy_flutter/assets/translations/en.jsonindex dd3435c19a..914c61fafe 100644--- a/frontend/appflowy_flutter/assets/translations/en.json+++ b/frontend/appflowy_flutter/assets/translations/en.json@@ -282,6 +282,7 @@"dateFormatISO": "Year-Month-Day","dateFormatLocal": "Month/Day/Year","dateFormatUS": "Year/Month/Day",+ "dateFormatDayMonthYear": "Day/Month/Year","timeFormat": "Time format","invalidTimeFormat": "Invalid format","timeFormatTwelveHour": "12 hour",diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dartindex 12237b8350..c2d46b0de1 100644--- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dart+++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/date.dart@@ -299,6 +299,8 @@ extension DateFormatExtension on DateFormat {return LocaleKeys.grid_field_dateFormatLocal.tr();case DateFormat.US:return LocaleKeys.grid_field_dateFormatUS.tr();+ case DateFormat.DayMonthYear:+ return LocaleKeys.grid_field_dateFormatDayMonthYear.tr();default:throw UnimplementedError;}diff --git a/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_tests.rs b/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_tests.rsindex afaa230d50..3ee8896590 100644--- a/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_tests.rs+++ b/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_tests.rs@@ -58,6 +58,16 @@ mod tests {&field_rev,);},+ DateFormat::DayMonthYear => {+ assert_date(+ &type_option,+ 1647251762,+ None,+ "14/03/2022",+ false,+ &field_rev,+ );+ },}}}diff --git a/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_type_option_entities.rs b/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_type_option_entities.rsindex f1b888dcaf..716ffa625a 100644--- a/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_type_option_entities.rs+++ b/frontend/rust-lib/flowy-database/src/services/field/type_options/date_type_option/date_type_option_entities.rs@@ -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",}}}