Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BirthdayCalendarGenerator #239

Merged
merged 13 commits into from
Jul 20, 2015
Merged

Add BirthdayCalendarGenerator #239

merged 13 commits into from
Jul 20, 2015

Conversation

DominikTo
Copy link
Member

No description provided.

BEGIN:VCARD
VERSION:3.0
N:Gump;Forrest;;Mr.
FN:Forrest Gump
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😋

@Hywan
Copy link
Member

Hywan commented Jul 7, 2015

👍 for me. Good job!

@DominikTo
Copy link
Member Author

I wonder:

  1. Should $format support using first name and last name separately (e.g. if a SUMMARY like John's Birthday -instead of John Doe's Birthday- is desired)?
  2. Should this method support falling back to N?
  3. Should this method maybe return null for vCards that have the proprietary X-ABShowAs:COMPANY set?
  4. Should we optionally generate multiple recurring instances, to support e.g. John Doe's 30. Birthday in the SUMMARY?

@evert
Copy link
Member

evert commented Jul 7, 2015

The only concern I have, is that I feel it might be better for this functionality to live outside of the vcard component. It's nice to keep the actual method that's in there, but perhaps there should be a separate BirthdayCalendarGenerator class.

Two reasons:

  1. The functionality is very similar to FreebusyGenerator. Ideally they also have very similar API's
  2. I imagine people will want to create birthdays calendars for multiple vcards at the same time. This would only allow creating 1 birthday VCALENDAR, so this would force people to run this multiple times and then merge afterwards. If there's an object similar to FreebusyGenerator, you could feed it multiple vcards.

VERSION:3.0
N:Gump;Forrest;;Mr.
FN:Forrest Gump
BDAY:19850407
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey that's my birthday! Are you calling me forest gump? :P

Regardless... you need to add a test for BDAY values without a year and without a month.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, no, I just added an easter egg and with your name it would have been too obvious. ;-)

@evert
Copy link
Member

evert commented Jul 7, 2015

It would also be real nice if you support ANNIVERSARY =)

@DominikTo
Copy link
Member Author

Good idea with the BirthdayCalendarGenerator, now I also remember that we talked about this. =)

@Hywan
Copy link
Member

Hywan commented Jul 7, 2015

BirthdayCalendarGenerator is better.

*
* @var int
*/
protected $defaultYear = 1900;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, once #242 is merged, the year defined in $minDate in the new Settings class should be used instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I came up with 1900 here... but I would actually suggest putting this a lot further in the future. Putting it on 1900 means that usually 115 recurrence instances will be created to calculate birthdays, and this will not be very efficient. I'd set it to 2010 I think.

@DominikTo DominikTo changed the title Added getBirthdayEvent method for VCards Add BirthdayCalendarGenerator Jul 9, 2015
@DominikTo
Copy link
Member Author

Ready for review.

@evert
Copy link
Member

evert commented Jul 20, 2015

  • All events need to have VALUE=DATE.
  • Timezone is not relevant for those, so you can strip all timezone-related stuff.

*
* @var int
*/
protected $defaultYear = 2000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be a constant.

@DominikTo
Copy link
Member Author

Thanks!

  • All events now have VALUE=DATE.
  • Timezone related stuff is stripped.
  • $defaultYear is now a DEFAULT_YEAR constant.
  • Added tests for previously untested stuff.

@DominikTo
Copy link
Member Author

Looks like this can't get merged automatically though. Should I merge master into this branch or rebase on master?

@evert
Copy link
Member

evert commented Jul 20, 2015

Merge master into this branch =)

@DominikTo
Copy link
Member Author

Done.

# Conflicts:
#	CHANGELOG.md
evert added a commit that referenced this pull request Jul 20, 2015
Add BirthdayCalendarGenerator
@evert evert merged commit 0d1e240 into master Jul 20, 2015
@evert
Copy link
Member

evert commented Jul 20, 2015

Awesome!

@Hywan
Copy link
Member

Hywan commented Jul 21, 2015

Awesome \o/.

@@ -37,8 +37,12 @@ ChangeLog
* #197: The `$children` property on components has been changed from `public`
to `protected`. Use the `children()` method instead to get a flat list of
objects.
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haaa damned, it is not supposed to be here 😉.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in fruux@87c6a50. Good.

@evert evert deleted the birthday-event branch January 11, 2016 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants