Skip to content
This repository has been archived by the owner on Aug 15, 2020. It is now read-only.

Add support for all day events. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

msealand
Copy link

First off, thanks for a great node module!

The project that I'm working on needed support for all day events. In an effort to get that working, I added support for an altType in CalendarProperty. This way we can use two different types for DTSTART (DATE-TIME and DATE). I then changed setDate() so that, when it is called with an undefined end parameter, it adds the DTSTART property using its altType (DATE) and does not add a DTEND or DURATION property. This makes the event appear as an all day event in my tests (using Apple's calendar app). This method of creating an all day event is mentioned in the RFC in section 3.6.1, page 53.

Hopefully this fits in with the direction you're going with the module, but let me know if it doesn't or if there's something you think should be implemented differently.

Add support for altType in CalendarProperty.  This way we can use two
different types for DTSTART (DATE-TIME and DATE).  When setDate() is
called with an undefined end parameter, add the DTSTART property using
its altType and do not add a DTEND or DURATION property.
@james-emerton
Copy link
Member

Thank you for your contribution. I apologize for the poor state of the documentation for this project; all-day events are in fact supported.

There are two ways to cause dates to be output as just a DATE value with no time component:

  • Set the date_only property on the date object to a truthy value. (I admit this is a little ugly, but it is how I "tag" date values that should only be dates internally.
  • Use the property setters directly and pass a value parameter: event.addProperty('DTSTART', date, {VALUE: 'DATE'})

I do like your enhancement to VEvent#setDate(), could you alter your patch to use the second method I describe?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants