Compare commits
3 commits
notion-to-
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1686293bac | |||
| b664f777d3 | |||
| 509b3ccd90 |
5 changed files with 7 additions and 8 deletions
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
1
Cargo.toml
Normal file → Executable file
1
Cargo.toml
Normal file → Executable file
|
|
@ -20,3 +20,4 @@ regex = "1.7.1"
|
|||
serde = { version = "^1.0", features = ["derive"], default-features = false }
|
||||
serde_json = { version = "^1.0", features = ["raw_value"], default-features = false }
|
||||
surf = { version = "2.3.2", default-features = false }
|
||||
uuid = "1.16.0"
|
||||
|
|
|
|||
0
LICENSE
Normal file → Executable file
0
LICENSE
Normal file → Executable file
0
README.md
Normal file → Executable file
0
README.md
Normal file → Executable file
14
src/lib.rs
Normal file → Executable file
14
src/lib.rs
Normal file → Executable file
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use chrono::{DateTime, NaiveTime, Utc};
|
||||
use chrono::{DateTime, Utc};
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use serde::de::Error as SerdeError;
|
||||
|
|
@ -701,7 +701,7 @@ pub struct ChildDatabase {
|
|||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
pub struct User {
|
||||
pub id: String,
|
||||
pub id: uuid::Uuid,
|
||||
pub name: Option<String>,
|
||||
pub person: Option<Person>,
|
||||
pub avatar_url: Option<String>,
|
||||
|
|
@ -1069,7 +1069,7 @@ pub enum RollupProperty {
|
|||
last_edited_time: DateValue,
|
||||
},
|
||||
Select {
|
||||
select: SelectOption,
|
||||
select: Option<SelectOption>,
|
||||
},
|
||||
MultiSelect {
|
||||
multi_select: Vec<SelectOption>,
|
||||
|
|
@ -1573,8 +1573,8 @@ impl std::fmt::Display for Date {
|
|||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
#[serde(try_from = "String", into = "String")]
|
||||
pub enum DateValue {
|
||||
Date(DateTime<Utc>),
|
||||
DateTime(DateTime<Utc>),
|
||||
Date(chrono::NaiveDate),
|
||||
}
|
||||
|
||||
impl TryFrom<String> for DateValue {
|
||||
|
|
@ -1583,9 +1583,7 @@ impl TryFrom<String> for DateValue {
|
|||
fn try_from(string: String) -> Result<DateValue> {
|
||||
// NOTE: is either ISO 8601 Date or assumed to be ISO 8601 DateTime
|
||||
let value = if ISO_8601_DATE.is_match(&string) {
|
||||
DateValue::Date(
|
||||
DateTime::parse_from_rfc3339(&format!("{string}T00:00:00Z"))?.date_naive(),
|
||||
)
|
||||
DateValue::Date(DateTime::parse_from_rfc3339(&format!("{string}T00:00:00Z"))?.into())
|
||||
} else {
|
||||
DateValue::DateTime(DateTime::parse_from_rfc3339(&string)?.with_timezone(&Utc))
|
||||
};
|
||||
|
|
@ -1603,7 +1601,7 @@ impl From<DateValue> for String {
|
|||
impl std::fmt::Display for DateValue {
|
||||
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
let value = match self {
|
||||
DateValue::Date(date) => date.and_time(NaiveTime::MIN).and_utc().to_rfc3339(),
|
||||
DateValue::Date(date) => date.format("%Y-%m-%d").to_string(),
|
||||
DateValue::DateTime(date_time) => date_time.to_rfc3339(),
|
||||
};
|
||||
Ok(write!(formatter, "{}", value)?)
|
||||
|
|
|
|||
Loading…
Reference in a new issue