mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Feat/rename views (#2495)
* refactor: rename belongings to child views * test: fix test
This commit is contained in:
@ -171,7 +171,7 @@ mod tests {
|
||||
date: Some("1653609600".to_owned()),
|
||||
time: Some("11:23 pm".to_owned()),
|
||||
include_time: Some(true),
|
||||
timezone_id: Some("Etc/UTC".to_owned()),
|
||||
timezone_id: Some(chrono_tz::Tz::Etc__UTC.to_string()),
|
||||
},
|
||||
None,
|
||||
"May 27, 2022 11:23 PM",
|
||||
|
@ -84,7 +84,7 @@ impl DateTypeOption {
|
||||
let naive = chrono::NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap();
|
||||
let offset = match Tz::from_str(&timezone_id) {
|
||||
Ok(timezone) => timezone.offset_from_utc_datetime(&naive).fix(),
|
||||
Err(_) => Local::now().offset().clone(),
|
||||
Err(_) => *Local::now().offset(),
|
||||
};
|
||||
|
||||
let date_time = DateTime::<Local>::from_utc(naive, offset);
|
||||
@ -206,9 +206,8 @@ impl CellDataChangeset for DateTypeOption {
|
||||
.from_utc_datetime(&NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap())
|
||||
.date_naive(),
|
||||
),
|
||||
None => match previous_datetime {
|
||||
Some(datetime) => Some(timezone.from_utc_datetime(&datetime).date_naive()),
|
||||
None => None,
|
||||
None => {
|
||||
previous_datetime.map(|datetime| timezone.from_utc_datetime(&datetime).date_naive())
|
||||
},
|
||||
};
|
||||
|
||||
@ -231,17 +230,15 @@ impl CellDataChangeset for DateTypeOption {
|
||||
Err(_) => match parsed_time {
|
||||
// same logic as above, but using local time instead of timezone
|
||||
Some(time) => {
|
||||
let offset = Local::now().offset().clone();
|
||||
|
||||
let offset = *Local::now().offset();
|
||||
let local_date = match new_date_timestamp {
|
||||
Some(timestamp) => Some(
|
||||
offset
|
||||
.from_utc_datetime(&NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap())
|
||||
.date_naive(),
|
||||
),
|
||||
None => match previous_datetime {
|
||||
Some(datetime) => Some(offset.from_utc_datetime(&datetime).date_naive()),
|
||||
None => None,
|
||||
None => {
|
||||
previous_datetime.map(|datetime| offset.from_utc_datetime(&datetime).date_naive())
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -64,8 +64,7 @@ impl From<&Cell> for DateCellData {
|
||||
fn from(cell: &Cell) -> Self {
|
||||
let timestamp = cell
|
||||
.get_str_value(CELL_DATE)
|
||||
.map(|data| data.parse::<i64>().ok())
|
||||
.flatten();
|
||||
.and_then(|data| data.parse::<i64>().ok());
|
||||
|
||||
let include_time = cell.get_bool_value("include_time").unwrap_or_default();
|
||||
let timezone_id = cell.get_str_value("timezone_id").unwrap_or_default();
|
||||
|
Reference in New Issue
Block a user