diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs index 03b4b194b0..f403a28272 100644 --- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs +++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs @@ -85,7 +85,17 @@ impl CellDataOperation for NumberTypeOption { let cell_data = type_option_cell_data.data; match self.format { - NumberFormat::Number => cell_data.parse::().map_or(String::new(), |v| v.to_string()), + NumberFormat::Number => { + if let Ok(v) = cell_data.parse::() { + return v.to_string(); + } + + if let Ok(v) = cell_data.parse::() { + return v.to_string(); + } + + return String::new(); + } NumberFormat::Percent => cell_data.parse::().map_or(String::new(), |v| v.to_string()), _ => self.money_from_str(&cell_data), } @@ -100,7 +110,8 @@ impl CellDataOperation for NumberTypeOption { _cell_meta: Option, ) -> Result { let changeset = changeset.into(); - let data = self.strip_symbol(changeset); + let data = changeset.to_string(); + let data = self.strip_symbol(data.trim()); if !data.chars().all(char::is_numeric) { return Err(FlowyError::invalid_data().context("Should only contain numbers"));