Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Doctype Event

jacquarg edited this page Oct 23, 2014 · 1 revision

Current model definition

November 2014 version :

module.exports = Event = americano.getModel 'Event',
    start       : type : String
    end         : type : String
    place       : type : String
    details     : type : String
    description : type : String
    rrule       : type : String
    tags        : type : (x) -> x # DAMN IT JUGGLING
    attendees   : type : [Object]
    related     : type : String, default: null
    timezone    : type : String
    alarms      : type : [Object]

# 'start' and 'end' use those format, 
# According to allDay or rrules.
Event.dateFormat = 'YYYY-MM-DD'
Event.ambiguousDTFormat = 'YYYY-MM-DD[T]HH:mm:00.000'
Event.utcDTFormat = 'YYYY-MM-DD[T]HH:mm:00.000Z'

# Handle only unique units strings.
Event.alarmTriggRegex = /(\+?|-)PT?(\d+)(W|D|H|M|S)/

DateTimes formats

start and end can have three formats defined by Event.dateFormat, Event.ambiguousDTFormat and Event.utcDTFormat, but they are always paired. The format use momentjs convention.

  • Event.utcDTFormat (which is the toISOString format) is used for punctual events (see Ponctual event).
  • Event.ambiguousDTFormat is used for recurring events (see Recurring event) and needs the timezone fieldin America/New_York (Olson ?) format.
  • Event.dateFormat is used for allDay events (see Allday event)

Event type discrimination

  • An Event is a recurrent event if and only if rrule is non empty.
  • An Event is an allday event if and only if start.length is 10.

Alarms

alarms is the list of reminders associated to this event. Each object of the list use the same model :

The goal is to maintain this model close to the alarm doctype.