|
@@ -1,7 +1,7 @@
|
|
|
+use crate::entities::{CellIdentifier, CellIdentifierPayload};
|
|
|
use crate::impl_type_option;
|
|
|
-use crate::services::entities::{CellIdentifier, CellIdentifierPayload};
|
|
|
use crate::services::field::{BoxTypeOptionBuilder, TypeOptionBuilder};
|
|
|
-use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellData, TypeOptionCellData};
|
|
|
+use crate::services::row::{CellContentChangeset, CellDataOperation, DecodedCellData, EncodedCellData};
|
|
|
use bytes::Bytes;
|
|
|
use chrono::format::strftime::StrftimeItems;
|
|
|
use chrono::NaiveDateTime;
|
|
@@ -77,32 +77,12 @@ impl DateTypeOption {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- pub fn make_date_cell_data(&self, cell_meta: &Option<CellMeta>) -> FlowyResult<DateCellData> {
|
|
|
- if cell_meta.is_none() {
|
|
|
- return Ok(DateCellData::default());
|
|
|
- }
|
|
|
-
|
|
|
- let json = &cell_meta.as_ref().unwrap().data;
|
|
|
- let result = TypeOptionCellData::from_str(json);
|
|
|
- if result.is_err() {
|
|
|
- return Ok(DateCellData::default());
|
|
|
- }
|
|
|
-
|
|
|
- let serde_cell_data = DateCellDataSerde::from_str(&result.unwrap().data)?;
|
|
|
- let date = self.decode_cell_data_from_timestamp(&serde_cell_data).content;
|
|
|
- let time = serde_cell_data.time.unwrap_or("".to_owned());
|
|
|
- let timestamp = serde_cell_data.timestamp;
|
|
|
-
|
|
|
- return Ok(DateCellData { date, time, timestamp });
|
|
|
- }
|
|
|
-
|
|
|
- fn decode_cell_data_from_timestamp(&self, serde_cell_data: &DateCellDataSerde) -> DecodedCellData {
|
|
|
+ fn date_desc_from_timestamp(&self, serde_cell_data: &DateCellDataSerde) -> String {
|
|
|
if serde_cell_data.timestamp == 0 {
|
|
|
- return DecodedCellData::default();
|
|
|
+ return "".to_owned();
|
|
|
}
|
|
|
|
|
|
- let cell_content = self.today_desc_from_timestamp(serde_cell_data.timestamp, &serde_cell_data.time);
|
|
|
- return DecodedCellData::new(serde_cell_data.timestamp.to_string(), cell_content);
|
|
|
+ self.today_desc_from_timestamp(serde_cell_data.timestamp, &serde_cell_data.time)
|
|
|
}
|
|
|
|
|
|
fn timestamp_from_utc_with_time(
|
|
@@ -131,34 +111,40 @@ impl DateTypeOption {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return Ok(utc.timestamp());
|
|
|
+ Ok(utc.timestamp())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl CellDataOperation for DateTypeOption {
|
|
|
- fn decode_cell_data(&self, data: String, _field_meta: &FieldMeta) -> DecodedCellData {
|
|
|
- if let Ok(type_option_cell_data) = TypeOptionCellData::from_str(&data) {
|
|
|
- // 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 !type_option_cell_data.is_date() {
|
|
|
- return DecodedCellData::default();
|
|
|
- }
|
|
|
- return match DateCellDataSerde::from_str(&type_option_cell_data.data) {
|
|
|
- Ok(serde_cell_data) => self.decode_cell_data_from_timestamp(&serde_cell_data),
|
|
|
- Err(_) => DecodedCellData::default(),
|
|
|
- };
|
|
|
+impl CellDataOperation<EncodedCellData<DateCellDataSerde>, DateCellDataSerde> for DateTypeOption {
|
|
|
+ fn decode_cell_data<T>(
|
|
|
+ &self,
|
|
|
+ encoded_data: T,
|
|
|
+ decoded_field_type: &FieldType,
|
|
|
+ _field_meta: &FieldMeta,
|
|
|
+ ) -> FlowyResult<DecodedCellData>
|
|
|
+ where
|
|
|
+ T: Into<EncodedCellData<DateCellDataSerde>>,
|
|
|
+ {
|
|
|
+ // 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 Ok(DecodedCellData::default());
|
|
|
}
|
|
|
|
|
|
- DecodedCellData::default()
|
|
|
+ let encoded_data = encoded_data.into().try_into_inner()?;
|
|
|
+ let date = self.date_desc_from_timestamp(&encoded_data);
|
|
|
+ let time = encoded_data.time.unwrap_or_else(|| "".to_owned());
|
|
|
+ let timestamp = encoded_data.timestamp;
|
|
|
+
|
|
|
+ DecodedCellData::try_from_bytes(DateCellData { date, time, timestamp })
|
|
|
}
|
|
|
|
|
|
- fn apply_changeset<T: Into<CellContentChangeset>>(
|
|
|
- &self,
|
|
|
- changeset: T,
|
|
|
- _cell_meta: Option<CellMeta>,
|
|
|
- ) -> Result<String, FlowyError> {
|
|
|
+ fn apply_changeset<C>(&self, changeset: C, _cell_meta: Option<CellMeta>) -> Result<DateCellDataSerde, FlowyError>
|
|
|
+ where
|
|
|
+ C: Into<CellContentChangeset>,
|
|
|
+ {
|
|
|
let content_changeset: DateCellContentChangeset = serde_json::from_str(&changeset.into())?;
|
|
|
let cell_data = match content_changeset.date_timestamp() {
|
|
|
None => DateCellDataSerde::default(),
|
|
@@ -173,7 +159,7 @@ impl CellDataOperation for DateTypeOption {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
- Ok(TypeOptionCellData::new(cell_data.to_string(), self.field_type()).json())
|
|
|
+ Ok(cell_data)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -307,23 +293,29 @@ impl DateCellDataSerde {
|
|
|
fn new(timestamp: i64, time: Option<String>, time_format: &TimeFormat) -> Self {
|
|
|
Self {
|
|
|
timestamp,
|
|
|
- time: Some(time.unwrap_or(default_time_str(time_format))),
|
|
|
+ time: Some(time.unwrap_or_else(|| default_time_str(time_format))),
|
|
|
}
|
|
|
}
|
|
|
|
|
|
pub(crate) fn from_timestamp(timestamp: i64, time: Option<String>) -> Self {
|
|
|
Self { timestamp, time }
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- fn to_string(self) -> String {
|
|
|
- serde_json::to_string(&self).unwrap_or("".to_string())
|
|
|
- }
|
|
|
+impl FromStr for DateCellDataSerde {
|
|
|
+ type Err = FlowyError;
|
|
|
|
|
|
- fn from_str(s: &str) -> FlowyResult<Self> {
|
|
|
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
|
serde_json::from_str::<DateCellDataSerde>(s).map_err(internal_error)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+impl ToString for DateCellDataSerde {
|
|
|
+ fn to_string(&self) -> String {
|
|
|
+ serde_json::to_string(&self).unwrap_or_else(|_| "".to_string())
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
fn default_time_str(time_format: &TimeFormat) -> String {
|
|
|
match time_format {
|
|
|
TimeFormat::TwelveHour => "12:00 AM".to_string(),
|
|
@@ -410,50 +402,45 @@ mod tests {
|
|
|
use crate::services::field::{
|
|
|
DateCellContentChangeset, DateCellData, DateCellDataSerde, DateFormat, DateTypeOption, TimeFormat,
|
|
|
};
|
|
|
- use crate::services::row::{CellDataOperation, TypeOptionCellData};
|
|
|
- use flowy_grid_data_model::entities::FieldType;
|
|
|
+ use crate::services::row::{CellDataOperation, EncodedCellData};
|
|
|
+ use flowy_grid_data_model::entities::{FieldMeta, FieldType};
|
|
|
use strum::IntoEnumIterator;
|
|
|
|
|
|
#[test]
|
|
|
fn date_description_invalid_input_test() {
|
|
|
let type_option = DateTypeOption::default();
|
|
|
- let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
|
|
|
- assert_eq!(
|
|
|
- "".to_owned(),
|
|
|
- type_option.decode_cell_data("1e".to_owned(), &field_meta).content
|
|
|
+ let field_type = FieldType::DateTime;
|
|
|
+ let field_meta = FieldBuilder::from_field_type(&field_type).build();
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some("1e".to_string()),
|
|
|
+ time: Some("23:00".to_owned()),
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "",
|
|
|
);
|
|
|
}
|
|
|
|
|
|
#[test]
|
|
|
fn date_description_date_format_test() {
|
|
|
let mut type_option = DateTypeOption::default();
|
|
|
- let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
|
|
|
+ let field_meta = FieldBuilder::from_field_type(&FieldType::DateTime).build();
|
|
|
for date_format in DateFormat::iter() {
|
|
|
type_option.date_format = date_format;
|
|
|
match date_format {
|
|
|
DateFormat::Friendly => {
|
|
|
- assert_eq!(
|
|
|
- "Mar 14,2022".to_owned(),
|
|
|
- type_option.decode_cell_data(data(1647251762), &field_meta).content
|
|
|
- );
|
|
|
+ assert_decode_timestamp(1647251762, &type_option, &field_meta, "Mar 14,2022");
|
|
|
}
|
|
|
DateFormat::US => {
|
|
|
- assert_eq!(
|
|
|
- "2022/03/14".to_owned(),
|
|
|
- type_option.decode_cell_data(data(1647251762), &field_meta).content
|
|
|
- );
|
|
|
+ assert_decode_timestamp(1647251762, &type_option, &field_meta, "2022/03/14");
|
|
|
}
|
|
|
DateFormat::ISO => {
|
|
|
- assert_eq!(
|
|
|
- "2022-03-14".to_owned(),
|
|
|
- type_option.decode_cell_data(data(1647251762), &field_meta).content
|
|
|
- );
|
|
|
+ assert_decode_timestamp(1647251762, &type_option, &field_meta, "2022-03-14");
|
|
|
}
|
|
|
DateFormat::Local => {
|
|
|
- assert_eq!(
|
|
|
- "2022/03/14".to_owned(),
|
|
|
- type_option.decode_cell_data(data(1647251762), &field_meta).content
|
|
|
- );
|
|
|
+ assert_decode_timestamp(1647251762, &type_option, &field_meta, "2022/03/14");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -462,84 +449,68 @@ mod tests {
|
|
|
#[test]
|
|
|
fn date_description_time_format_test() {
|
|
|
let mut type_option = DateTypeOption::default();
|
|
|
- let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
|
|
|
+ let field_type = FieldType::DateTime;
|
|
|
+ let field_meta = FieldBuilder::from_field_type(&field_type).build();
|
|
|
+
|
|
|
for time_format in TimeFormat::iter() {
|
|
|
type_option.time_format = time_format;
|
|
|
+ type_option.include_time = true;
|
|
|
match time_format {
|
|
|
TimeFormat::TwentyFourHour => {
|
|
|
- assert_eq!(
|
|
|
- "Mar 14,2022".to_owned(),
|
|
|
- type_option.today_desc_from_timestamp(1647251762, &None)
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(1653609600.to_string()),
|
|
|
+ time: None,
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022 00:00",
|
|
|
);
|
|
|
- assert_eq!(
|
|
|
- "Mar 14,2022".to_owned(),
|
|
|
- type_option.decode_cell_data(data(1647251762), &field_meta).content
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(1653609600.to_string()),
|
|
|
+ time: Some("23:00".to_owned()),
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022 23:00",
|
|
|
);
|
|
|
}
|
|
|
TimeFormat::TwelveHour => {
|
|
|
- assert_eq!(
|
|
|
- "Mar 14,2022".to_owned(),
|
|
|
- type_option.today_desc_from_timestamp(1647251762, &None)
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(1653609600.to_string()),
|
|
|
+ time: None,
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022 12:00 AM",
|
|
|
);
|
|
|
- assert_eq!(
|
|
|
- "Mar 14,2022".to_owned(),
|
|
|
- type_option.decode_cell_data(data(1647251762), &field_meta).content
|
|
|
+
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(1653609600.to_string()),
|
|
|
+ time: Some("".to_owned()),
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022",
|
|
|
);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- #[test]
|
|
|
- fn date_description_time_format_test2() {
|
|
|
- let mut type_option = DateTypeOption::default();
|
|
|
- let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
|
|
|
- for time_format in TimeFormat::iter() {
|
|
|
- type_option.time_format = time_format;
|
|
|
- type_option.include_time = true;
|
|
|
- match time_format {
|
|
|
- TimeFormat::TwentyFourHour => {
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(1653609600.to_string()),
|
|
|
- time: None,
|
|
|
- };
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!("May 27,2022 00:00".to_owned(), content);
|
|
|
-
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(1653609600.to_string()),
|
|
|
- time: Some("23:00".to_owned()),
|
|
|
- };
|
|
|
-
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!("May 27,2022 23:00".to_owned(), content);
|
|
|
- }
|
|
|
- TimeFormat::TwelveHour => {
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(1653609600.to_string()),
|
|
|
- time: None,
|
|
|
- };
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!("May 27,2022 12:00 AM".to_owned(), content);
|
|
|
-
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(1653609600.to_string()),
|
|
|
- time: Some("".to_owned()),
|
|
|
- };
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!("May 27,2022".to_owned(), content);
|
|
|
-
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(1653609600.to_string()),
|
|
|
- time: Some("11:23 pm".to_owned()),
|
|
|
- };
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!("May 27,2022 11:23 PM".to_owned(), content);
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(1653609600.to_string()),
|
|
|
+ time: Some("11:23 pm".to_owned()),
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022 11:23 PM",
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -548,37 +519,55 @@ mod tests {
|
|
|
#[test]
|
|
|
fn date_description_apply_changeset_test() {
|
|
|
let mut type_option = DateTypeOption::default();
|
|
|
- let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
|
|
|
+ let field_type = FieldType::DateTime;
|
|
|
+ let field_meta = FieldBuilder::from_field_type(&field_type).build();
|
|
|
let date_timestamp = "1653609600".to_owned();
|
|
|
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(date_timestamp.clone()),
|
|
|
- time: None,
|
|
|
- };
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result.clone(), &field_meta).content;
|
|
|
- assert_eq!(content, "May 27,2022".to_owned());
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(date_timestamp.clone()),
|
|
|
+ time: None,
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022",
|
|
|
+ );
|
|
|
|
|
|
type_option.include_time = true;
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!(content, "May 27,2022 00:00".to_owned());
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(date_timestamp.clone()),
|
|
|
+ time: None,
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022 00:00",
|
|
|
+ );
|
|
|
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(date_timestamp.clone()),
|
|
|
- time: Some("1:00".to_owned()),
|
|
|
- };
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!(content, "May 27,2022 01:00".to_owned());
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(date_timestamp.clone()),
|
|
|
+ time: Some("1:00".to_owned()),
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022 01:00",
|
|
|
+ );
|
|
|
|
|
|
- let changeset = DateCellContentChangeset {
|
|
|
- date: Some(date_timestamp),
|
|
|
- time: Some("1:00 am".to_owned()),
|
|
|
- };
|
|
|
type_option.time_format = TimeFormat::TwelveHour;
|
|
|
- let result = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
- let content = type_option.decode_cell_data(result, &field_meta).content;
|
|
|
- assert_eq!(content, "May 27,2022 01:00 AM".to_owned());
|
|
|
+ assert_changeset_result(
|
|
|
+ &type_option,
|
|
|
+ DateCellContentChangeset {
|
|
|
+ date: Some(date_timestamp),
|
|
|
+ time: Some("1:00 am".to_owned()),
|
|
|
+ },
|
|
|
+ &field_type,
|
|
|
+ &field_meta,
|
|
|
+ "May 27,2022 01:00 AM",
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
#[test]
|
|
@@ -586,7 +575,7 @@ mod tests {
|
|
|
fn date_description_apply_changeset_error_test() {
|
|
|
let mut type_option = DateTypeOption::default();
|
|
|
type_option.include_time = true;
|
|
|
- let field_meta = FieldBuilder::from_field_type(&FieldType::Number).build();
|
|
|
+ let _field_meta = FieldBuilder::from_field_type(&FieldType::DateTime).build();
|
|
|
let date_timestamp = "1653609600".to_owned();
|
|
|
|
|
|
let changeset = DateCellContentChangeset {
|
|
@@ -596,7 +585,7 @@ mod tests {
|
|
|
let _ = type_option.apply_changeset(changeset, None).unwrap();
|
|
|
|
|
|
let changeset = DateCellContentChangeset {
|
|
|
- date: Some(date_timestamp.clone()),
|
|
|
+ date: Some(date_timestamp),
|
|
|
time: Some("1:".to_owned()),
|
|
|
};
|
|
|
let _ = type_option.apply_changeset(changeset, None).unwrap();
|
|
@@ -609,8 +598,39 @@ mod tests {
|
|
|
type_option.apply_changeset("he", None).unwrap();
|
|
|
}
|
|
|
|
|
|
- fn data(s: i64) -> String {
|
|
|
- let json = serde_json::to_string(&DateCellDataSerde::from_timestamp(s, None)).unwrap();
|
|
|
- TypeOptionCellData::new(&json, FieldType::DateTime).json()
|
|
|
+ fn assert_changeset_result(
|
|
|
+ type_option: &DateTypeOption,
|
|
|
+ changeset: DateCellContentChangeset,
|
|
|
+ _field_type: &FieldType,
|
|
|
+ field_meta: &FieldMeta,
|
|
|
+ expected: &str,
|
|
|
+ ) {
|
|
|
+ let encoded_data = EncodedCellData(Some(type_option.apply_changeset(changeset, None).unwrap()));
|
|
|
+ assert_eq!(
|
|
|
+ expected.to_owned(),
|
|
|
+ decode_cell_data(encoded_data, type_option, field_meta)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ fn assert_decode_timestamp(timestamp: i64, type_option: &DateTypeOption, field_meta: &FieldMeta, expected: &str) {
|
|
|
+ let serde_json = DateCellDataSerde { timestamp, time: None }.to_string();
|
|
|
+
|
|
|
+ assert_eq!(
|
|
|
+ expected.to_owned(),
|
|
|
+ decode_cell_data(serde_json, type_option, field_meta)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ fn decode_cell_data<T: Into<EncodedCellData<DateCellDataSerde>>>(
|
|
|
+ encoded_data: T,
|
|
|
+ type_option: &DateTypeOption,
|
|
|
+ field_meta: &FieldMeta,
|
|
|
+ ) -> String {
|
|
|
+ type_option
|
|
|
+ .decode_cell_data(encoded_data, &FieldType::DateTime, field_meta)
|
|
|
+ .unwrap()
|
|
|
+ .parse::<DateCellData>()
|
|
|
+ .unwrap()
|
|
|
+ .date
|
|
|
}
|
|
|
}
|