I am working on a web application, where one of the functionalities is to provide billboard listings based on a date that you insert.
I found this great unofficial API for Billboard charts: http://billboard.modulo.site/
As you can see in the documentation you can provide a date for the REQUEST and get the official "hot 100" listings for that date.
However, one constraint with this is that the date provided has to be a saturday(that's when Billboard updates their charts each week). If you input a date that is not a saturday the response is a json with empty arrays.
If I present the user with the option to select the year, month, and date(or week, doesn't matter) what would be the most efficient solution in Javascript to convert that to the date of the saturday on the same week?
For instance let's say the user inputs the following date: 2016-03-04 (which is a Friday)
How could I check what day of the week 2016-03-04 is - so that I could change that to 2016-03-05(which is the saturday)?
It would be even more pleasant if the user input would be
Year: 2016
Month: March
Week: 9
and then get the date of the saturday of week 9 but not sure if that's possible.
The simplest solutions seems to just see which day of the week a provided date is, but not sure how one could go through with that.. Any ideas?