From 07b36febc2f402be9c5c1a9323ce90ba56b5488c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 15 Apr 2018 02:09:52 +0200 Subject: build_rss(write_feed): Automatically handle date formatting * Take a date formatted in `%Y-%m-%d` and append the extra `THH:MM:SS` that the Meetup API requires. We'll just be taking a regular string from a user-inputted command line argument instead of a real date type because it's easier and simpler. * Use the name `end_date` to distinguish it from the `end_date_range` parameter used by the API. --- src/build_rss.rs | 4 ++-- src/main.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/build_rss.rs b/src/build_rss.rs index 0c31a43..d6ab35f 100644 --- a/src/build_rss.rs +++ b/src/build_rss.rs @@ -9,7 +9,7 @@ pub fn write_feed( token: String, latitude: String, longitude: String, - end_date_range: String, + end_date: String, radius: Option, page: Option, ) -> Result<()> { @@ -17,7 +17,7 @@ pub fn write_feed( let events = client.find_upcoming_events( latitude, longitude, - end_date_range, + format!("{}T00:00:00", end_date), radius, page )?; diff --git a/src/main.rs b/src/main.rs index 4c54e85..259767a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,7 @@ fn run() -> Result<()> { meetup_token, "48".to_owned(), "2".to_owned(), - "2018-04-17T00:00:00".to_owned(), + "2018-04-17".to_owned(), None, None, ).chain_err(|| "could not write RSS feed.")?; -- cgit v1.2.3