skybluesofa / onthisday

Get fun events and holidays for a given day.
MIT License
3 stars 6 forks source link

Add 'when is' functionality #4

Open skybluesofa opened 8 years ago

skybluesofa commented 8 years ago

This is a reverse lookup of events/holidays. When a name is passed in, it should return an array of Carbon dates for the given event/holiday name. The reason for the array value is that, there are some events that have the same name, but have been proposed by different sponsors. In this case, both dates would be returned in the array.

For instance, if the method OnThisDay::whenIs('Halloween') is run during 2016, the return value would be [Carbon '10/31/2016'].

Another instance, if the method OnThisDay::whenIs('Thanksgiving', '2012') is run, the return value would be [Carbon '11/22/2012'].

Requirements:

LeWestopher commented 8 years ago

I'm going to work on this for Hacktober. The requirements seem simple enough, but could you give me an example where there would be multiple dates returned in an array due to proposal by "differing sponsors"? Thanks!

skybluesofa commented 8 years ago

Check out the Data/En/Us/February.php data file. In the getRecurringAdvancedConfigurationBasedEvents() function, 'Museum Advocacy Days' is on the first Monday and Tuesday of the February.

On a side note, I'm looking at refactoring the getRecurringAdvancedConfigurationBasedEvents() and getRecurringAdvancedConfigurationBasedHolidays() methods in a way that could affect your code (the issue is available at https://github.com/skybluesofa/onthisday/issues/6). I think that once this refactor is done, it would make the whenIs functionality easier to implement.

Let me know if you are still interested.

skybluesofa commented 8 years ago

I've updated the data files to more easily accommodate this functionality.