Format
This commit is contained in:
parent
4f796e788c
commit
0020242571
@ -756,7 +756,11 @@ impl FromId<DbConn> for Post {
|
|||||||
let timestamp_secs = published.unix_timestamp();
|
let timestamp_secs = published.unix_timestamp();
|
||||||
let timestamp_nanos = published.unix_timestamp_nanos()
|
let timestamp_nanos = published.unix_timestamp_nanos()
|
||||||
- (timestamp_secs as i128) * 1000i128 * 1000i128 * 1000i128;
|
- (timestamp_secs as i128) * 1000i128 * 1000i128 * 1000i128;
|
||||||
NaiveDateTime::from_timestamp_opt(timestamp_secs, timestamp_nanos as u32).unwrap()
|
NaiveDateTime::from_timestamp_opt(
|
||||||
|
timestamp_secs,
|
||||||
|
timestamp_nanos as u32,
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
}),
|
}),
|
||||||
subtitle: article
|
subtitle: article
|
||||||
.summary()
|
.summary()
|
||||||
|
@ -180,9 +180,13 @@ impl PlumeQuery {
|
|||||||
|
|
||||||
if self.before.is_some() || self.after.is_some() {
|
if self.before.is_some() || self.after.is_some() {
|
||||||
// if at least one range bound is provided
|
// if at least one range bound is provided
|
||||||
let after = self
|
let after = self.after.unwrap_or_else(|| {
|
||||||
.after
|
i64::from(
|
||||||
.unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce()));
|
NaiveDate::from_ymd_opt(2000, 1, 1)
|
||||||
|
.unwrap()
|
||||||
|
.num_days_from_ce(),
|
||||||
|
)
|
||||||
|
});
|
||||||
let before = self
|
let before = self
|
||||||
.before
|
.before
|
||||||
.unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce()));
|
.unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce()));
|
||||||
@ -209,9 +213,13 @@ impl PlumeQuery {
|
|||||||
|
|
||||||
// documents older than the provided date will be ignored
|
// documents older than the provided date will be ignored
|
||||||
pub fn after<D: Datelike>(&mut self, date: &D) -> &mut Self {
|
pub fn after<D: Datelike>(&mut self, date: &D) -> &mut Self {
|
||||||
let after = self
|
let after = self.after.unwrap_or_else(|| {
|
||||||
.after
|
i64::from(
|
||||||
.unwrap_or_else(|| i64::from(NaiveDate::from_ymd_opt(2000, 1, 1).unwrap().num_days_from_ce()));
|
NaiveDate::from_ymd_opt(2000, 1, 1)
|
||||||
|
.unwrap()
|
||||||
|
.num_days_from_ce(),
|
||||||
|
)
|
||||||
|
});
|
||||||
self.after = Some(cmp::max(after, i64::from(date.num_days_from_ce())));
|
self.after = Some(cmp::max(after, i64::from(date.num_days_from_ce())));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user