Skip to content

Commit

Permalink
Added Event, Iterator, Identifier, Modifiers (include, cancel, meta, …
Browse files Browse the repository at this point in the history
…exclude)

- Resolves #6
- Resolves #5
- Resolves #4
- Resolves #3
- Resolves #2
  • Loading branch information
ClickerMonkey committed Jun 7, 2018
1 parent 1253687 commit e469b1f
Show file tree
Hide file tree
Showing 26 changed files with 4,923 additions and 1,426 deletions.
52 changes: 34 additions & 18 deletions README.md
Expand Up @@ -7,15 +7,29 @@ A date & schedule library to use for advanced calendars in TypeScript and JS.
- [Download JS](umd/dayspan.js)
- Install via `bower install dayspan` or `npm install dayspan`

### Features

- Schedules track how frequent events occur using 20+ properties
- Events can last minutes, hours, days, or weeks
- Events can occur all day, or 1 or more times during the day
- Events can have any day & time included as an event occurrence (they don't need to match the frequency of the schedule)
- Events can be excluded, cancelled, or have metadata (specific event occurrence, all in a given day, week, month, quarter, or year)
- Event occurrences can be moved
- Calendars can represent a span of days, weeks, months, or years
- Easily list the next/previous days that occur on a schedule
- Describe a schedule in a human friendly string
- Export and import schedules and calendars to plain objects for easy saving and loading
- Provides logic to help display intersecting events on a calendar

### TypeScript Example

```typescript
// A monthly calendar around today
let cal = Calendar.months<string>();
// A monthly calendar around today (string=event data type, any=schedule metadata type)
let cal = Calendar.months<string, any>();

// Every Monday 9:00 - 9:30
cal.addSchedule({
event: 'Weekly Meeting',
cal.addEvent({
data: 'Weekly Meeting',
schedule: {
dayOfWeek: [Weekday.MONDAY],
times: [9],
Expand All @@ -25,16 +39,18 @@ cal.addSchedule({
});

// Dr. Appointment on 01/04/2018
cal.addSchedule({
event: 'Dr. Appointment',
schedule: new Schedule({
cal.addEvent({
data: 'Dr. Appointment',
visible: false,
schedule: {
on: Day.build(2018, Month.APRIL, 1)
})
}
});

// Mother's Day
cal.addSchedule({
event: "Mother's Day",
cal.addEvent({
id: 'someUserProvidedId',
data: "Mother's Day",
schedule: new Schedule({
weekspanOfMonth: [1], // 2nd
dayOfWeek: [Weekday.SUNDAY], // Sunday
Expand All @@ -52,16 +68,16 @@ cal.next();
cal.select(Day.build(2018, Month.APRIL, 12));

// Remove the schedule
cal.removeSchedule('Weekly Meeting');
cal.removeEvent('Weekly Meeting');

// A weekly calendar with custom MyEvent class
Calendar.weeks<MyEvent>();
Calendar.weeks<MyEvent, any>();

// A daily calendar covering 3 days centered on today
Calendar.days<string>(3);
Calendar.days<string, any>(3);

// A daily calendar covering 3 days starting with given date
Calendar.days<string>(3, Day.build(2018, Month.JUNE, 15), 0);
Calendar.days<string, any>(3, Day.build(2018, Month.JUNE, 15), 0);
```

### JS Example
Expand All @@ -73,8 +89,8 @@ You just need to append `ds` to the beginning of the classes:
var cal = ds.Calendar.months();

// Every Monday 9:00 - 9:30
cal.addSchedule({
event: 'Weekly Meeting',
cal.addEvent({
data: 'Weekly Meeting',
schedule: {
dayOfWeek: [ds.Weekday.MONDAY],
times: [9],
Expand All @@ -84,8 +100,8 @@ cal.addSchedule({
});

// Dr. Appointment on 01/04/2018
cal.addSchedule({
event: 'Dr. Appointment',
cal.addEvent({
data: 'Dr. Appointment',
schedule: new ds.Schedule({
on: ds.Day.build(2018, ds.Month.APRIL, 1)
})
Expand Down

0 comments on commit e469b1f

Please sign in to comment.