You're an attractive code golfer and quite a few people are asking you out.
You don't have time to think about which days exactly you're available, so you decide to create a function the accepts a date and returns the days of that week.
You then take those days of the week, insert it into your calendar program to see if anyone else has asked you out already.
- Accepts a date in YYYY-MM-DD format
- Returns an array/list of dates of that week. (Sunday is the first day)
- The dates can be displayed as the milliseconds between January 1, 1970 and that date, in a "common" date format1, or date objects.
- The order of the dates must be ascending.
- (Although you're smart enough to include support for a descending list, the program is able to work quickest with an ascending list and who has a few milliseconds to spare?)
- Must work with on any day since 1993. (Yes, you're 24 years old at the time of writing!)
Output: (the equivalent of)
console.log([ Date.parse('2017-08-27'), Date.parse('2017-08-28'), Date.parse('2017-08-29'), Date.parse('2017-08-30'), Date.parse('2017-08-31'), Date.parse('2017-09-01'), Date.parse('2017-09-02'), ]);
1 A format that is fairly well known. Such as YYYY-MM-DD.
2 This is code-golf! Shortest code per language wins, but the shortest code overall gets the emerald checkmark!