shalvah / oldtweets.today

"On This Day" for Twitter #TwitterThrowback
http://oldtweets.today
113 stars 24 forks source link

Use 'date' query parameter if available, instead of current date #22

Closed frontendtony closed 5 years ago

frontendtony commented 5 years ago

This PR sets the serverless function to use the URL date query parameter where available and to default to the current date where unavailable.

How to test

Include a date query parameter like below and it will return tweets from that particular day from previous years, up to 2016

https://europe-west1-oldtweetstoday.cloudfunctions.net/getTweetsOnThisDay?username=oghie_js&from=2019&until=2016&date=2019-1-15

shalvah commented 5 years ago

This should be a day parameter, not a date.

Better yet, month and day parameters. That has several benefits:

frontendtony commented 5 years ago

I have switched to using day and month parameters as advised and it does make more sense

Note that the month uses 1-based indexing (January === 1)

shalvah commented 5 years ago

Good work @Tonerolima. And yeah, 1-based index for the month is definitely the way to go.