ical-generator 5.0.2-develop.2 → 6.0.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/event.ts CHANGED
@@ -57,7 +57,7 @@ export enum ICalEventClass {
57
57
  export interface ICalEventData {
58
58
  id?: string | number | null,
59
59
  sequence?: number,
60
- start?: ICalDateTimeValue | null,
60
+ start: ICalDateTimeValue,
61
61
  end?: ICalDateTimeValue | null,
62
62
  recurrenceId?: ICalDateTimeValue | null,
63
63
  timezone?: string | null,
@@ -87,7 +87,7 @@ export interface ICalEventData {
87
87
  interface ICalEventInternalData {
88
88
  id: string,
89
89
  sequence: number,
90
- start: ICalDateTimeValue | null,
90
+ start: ICalDateTimeValue,
91
91
  end: ICalDateTimeValue | null,
92
92
  recurrenceId: ICalDateTimeValue | null,
93
93
  timezone: string | null,
@@ -117,7 +117,7 @@ interface ICalEventInternalData {
117
117
  export interface ICalEventJSONData {
118
118
  id: string,
119
119
  sequence: number,
120
- start: string | null,
120
+ start: string,
121
121
  end: string | null,
122
122
  recurrenceId: string | null,
123
123
  timezone: string | null,
@@ -180,7 +180,7 @@ export default class ICalEvent {
180
180
  this.data = {
181
181
  id: uuid(),
182
182
  sequence: 0,
183
- start: null,
183
+ start: new Date(),
184
184
  end: null,
185
185
  recurrenceId: null,
186
186
  timezone: null,
@@ -318,7 +318,7 @@ export default class ICalEvent {
318
318
  *
319
319
  * @since 0.2.0
320
320
  */
321
- start(): ICalDateTimeValue | null;
321
+ start(): ICalDateTimeValue;
322
322
 
323
323
  /**
324
324
  * Set the appointment date of beginning, which is required for all events.
@@ -329,7 +329,7 @@ export default class ICalEvent {
329
329
  * @since 0.2.0
330
330
  */
331
331
  start(start: ICalDateTimeValue): this;
332
- start(start?: ICalDateTimeValue): this | ICalDateTimeValue | null {
332
+ start(start?: ICalDateTimeValue): this | ICalDateTimeValue {
333
333
  if (start === undefined) {
334
334
  return this.data.start;
335
335
  }
@@ -878,13 +878,13 @@ export default class ICalEvent {
878
878
  *
879
879
  * @since 0.2.0
880
880
  */
881
- createAttendee(data: ICalAttendee | ICalAttendeeData | string = {}): ICalAttendee {
881
+ createAttendee(data: ICalAttendee | ICalAttendeeData | string): ICalAttendee {
882
882
  if (data instanceof ICalAttendee) {
883
883
  this.data.attendees.push(data);
884
884
  return data;
885
885
  }
886
886
  if (typeof data === 'string') {
887
- data = checkNameAndMail('data', data);
887
+ data = { email: data, ...checkNameAndMail('data', data) };
888
888
  }
889
889
 
890
890
  const attendee = new ICalAttendee(data, this);
@@ -945,7 +945,7 @@ export default class ICalEvent {
945
945
  *
946
946
  * @since 0.2.1
947
947
  */
948
- createAlarm(data: ICalAlarm | ICalAlarmData = {}): ICalAlarm {
948
+ createAlarm(data: ICalAlarm | ICalAlarmData): ICalAlarm {
949
949
  const alarm = data instanceof ICalAlarm ? data : new ICalAlarm(data, this);
950
950
  this.data.alarms.push(alarm);
951
951
  return alarm;
@@ -1002,7 +1002,7 @@ export default class ICalEvent {
1002
1002
  *
1003
1003
  * @since 0.3.0
1004
1004
  */
1005
- createCategory(data: ICalCategory | ICalCategoryData = {}): ICalCategory {
1005
+ createCategory(data: ICalCategory | ICalCategoryData): ICalCategory {
1006
1006
  const category = data instanceof ICalCategory ? data : new ICalCategory(data);
1007
1007
  this.data.categories.push(category);
1008
1008
  return category;
@@ -1442,10 +1442,6 @@ export default class ICalEvent {
1442
1442
  toString(): string {
1443
1443
  let g = '';
1444
1444
 
1445
- if (!this.data.start) {
1446
- throw new Error('No value for `start` in ICalEvent #' + this.data.id + ' given!');
1447
- }
1448
-
1449
1445
  // DATE & TIME
1450
1446
  g += 'BEGIN:VEVENT\r\n';
1451
1447
  g += 'UID:' + this.data.id + '\r\n';
@@ -1621,9 +1617,9 @@ export default class ICalEvent {
1621
1617
 
1622
1618
  // CATEGORIES
1623
1619
  if (this.data.categories.length > 0) {
1624
- g += 'CATEGORIES:' + this.data.categories.map(function (category) {
1625
- return category.toString();
1626
- }).join() + '\r\n';
1620
+ g += 'CATEGORIES:' + this.data.categories
1621
+ .map(category => category.toString())
1622
+ .join() + '\r\n';
1627
1623
  }
1628
1624
 
1629
1625
  // URL
package/src/index.ts CHANGED
@@ -49,6 +49,7 @@ export default ical;
49
49
  export {
50
50
  default as ICalAlarm,
51
51
  ICalAlarmData,
52
+ ICalAlarmRepeatData,
52
53
  ICalAlarmType,
53
54
  ICalAlarmTypeValue,
54
55
  ICalAlarmJSONData,
@@ -74,7 +75,8 @@ export {
74
75
 
75
76
  export {
76
77
  default as ICalCategory,
77
- ICalCategoryData
78
+ ICalCategoryData,
79
+ ICalCategoryJSONData
78
80
  } from './category.js';
79
81
 
80
82
  export {
package/src/tools.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  import {
4
- ICalDateTimeValue, ICalDayJsStub, ICalLuxonDateTimeStub,
4
+ ICalDateTimeValue,
5
+ ICalDayJsStub,
6
+ ICalLuxonDateTimeStub,
5
7
  ICalMomentDurationStub,
6
8
  ICalMomentStub,
7
9
  ICalMomentTimezoneStub,