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
fix: don't use timestamp fields to make calendar (#3366)
Richard Shiuea4681a404259
diff --git a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rsindex f2ece71435..5d25b290f1 100644--- a/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs+++ b/frontend/rust-lib/flowy-database2/src/entities/field_entities.rs@@ -558,8 +558,6 @@ impl FieldType {pub fn is_date(&self) -> bool {matches!(self, FieldType::DateTime)- || matches!(self, FieldType::LastEditedTime)- || matches!(self, FieldType::CreatedTime)}pub fn is_single_select(&self) -> bool {diff --git a/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs b/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rsindex 366ab9b8ad..07ebd91bf1 100644--- a/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs+++ b/frontend/rust-lib/flowy-database2/src/services/cell/type_cell_data.rs@@ -82,8 +82,6 @@ impl TypeCellData {pub fn is_date(&self) -> bool {self.field_type == FieldType::DateTime- || self.field_type == FieldType::LastEditedTime- || self.field_type == FieldType::CreatedTime}pub fn is_single_select(&self) -> bool {diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rsindex 83f9c28c8f..4171be4146 100644--- a/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/layout_deps.rs@@ -51,7 +51,7 @@ impl DatabaseLayoutDepsResolver {.lock().get_fields(None).into_iter()- .find(|field| FieldType::from(field.field_type).is_date())+ .find(|field| FieldType::from(field.field_type) == FieldType::DateTime){Some(field) => {let layout_setting = CalendarLayoutSetting::new(field.id).into();diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rsindex 91afbdca93..0ee75faed7 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/number_type_option/number_type_option.rs@@ -184,7 +184,10 @@ impl CellDataDecoder for NumberTypeOption {decoded_field_type: &FieldType,_field: &Field,) -> FlowyResult<<Self as TypeOption>::CellData> {- if decoded_field_type.is_date() {+ if decoded_field_type.is_date()+ || decoded_field_type.is_created_time()+ || decoded_field_type.is_last_edited_time()+ {return Ok(Default::default());}diff --git a/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs b/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rsindex c27816052f..30aacb4b55 100644--- a/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs+++ b/frontend/rust-lib/flowy-database2/src/services/field/type_options/timestamp_type_option/timestamp_type_option.rs@@ -130,11 +130,8 @@ impl CellDataDecoder for TimestampTypeOption {decoded_field_type: &FieldType,_field: &Field,) -> FlowyResult<<Self as TypeOption>::CellData> {- // Return default data if the type_option_cell_data is not FieldType::DateTime.- // It happens when switching from one field to another.- // For example:- // FieldType::RichText -> FieldType::DateTime, it will display empty content on the screen.- if !decoded_field_type.is_date() {+ // Return default data if the type_option_cell_data is not FieldType::CreatedTime nor FieldType::LastEditedTime+ if !decoded_field_type.is_last_edited_time() && !decoded_field_type.is_created_time() {return Ok(Default::default());}@@ -177,7 +174,7 @@ impl TypeOptionCellDataFilter for TimestampTypeOption {field_type: &FieldType,cell_data: &<Self as TypeOption>::CellData,) -> bool {- if !field_type.is_date() {+ if !field_type.is_last_edited_time() && !field_type.is_created_time() {return true;}