aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-04-15 02:09:52 +0200
committerTeddy Wing2018-04-15 02:09:52 +0200
commit07b36febc2f402be9c5c1a9323ce90ba56b5488c (patch)
tree238232a5863481c2e3998dedd74060dbb2a3fc57
parent6149d7601cd3a63c6531846ea9d7fa9c584c35f7 (diff)
downloadmeetup-find-events-rss-07b36febc2f402be9c5c1a9323ce90ba56b5488c.tar.bz2
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.
-rw-r--r--src/build_rss.rs4
-rw-r--r--src/main.rs2
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<String>,
page: Option<String>,
) -> 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.")?;