@forcecalendar/core 2.1.70 → 2.2.0
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/core/calendar/Calendar.js +5 -5
- package/core/conflicts/ConflictDetector.js +5 -5
- package/core/events/Event.js +17 -17
- package/core/events/EventStore.js +16 -16
- package/core/events/RecurrenceEngine.js +4 -4
- package/core/ics/ICSHandler.js +5 -3
- package/core/index.js +5 -1
- package/core/state/StateManager.js +3 -3
- package/core/types.js +17 -14
- package/package.json +40 -20
- package/types/calendar/Calendar.d.ts +287 -0
- package/types/calendar/DateUtils.d.ts +298 -0
- package/types/conflicts/ConflictDetector.d.ts +103 -0
- package/types/events/Event.d.ts +329 -0
- package/types/events/EventStore.d.ts +341 -0
- package/types/events/RRuleParser.d.ts +60 -0
- package/types/events/RecurrenceEngine.d.ts +128 -0
- package/types/events/RecurrenceEngineV2.d.ts +140 -0
- package/types/ics/ICSHandler.d.ts +111 -0
- package/types/ics/ICSParser.d.ts +111 -0
- package/types/index.d.ts +22 -0
- package/types/integration/EnhancedCalendar.d.ts +76 -0
- package/types/performance/AdaptiveMemoryManager.d.ts +104 -0
- package/types/performance/LRUCache.d.ts +59 -0
- package/types/performance/PerformanceOptimizer.d.ts +134 -0
- package/types/search/EventSearch.d.ts +91 -0
- package/types/search/SearchWorkerManager.d.ts +116 -0
- package/types/state/StateManager.d.ts +200 -0
- package/types/timezone/TimezoneDatabase.d.ts +993 -0
- package/types/timezone/TimezoneManager.d.ts +134 -0
- package/types/types.d.ts +1225 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { EventStore } from '../events/EventStore.js';
|
|
2
|
+
import { Event } from '../events/Event.js';
|
|
3
|
+
import { StateManager } from '../state/StateManager.js';
|
|
4
|
+
import { TimezoneManager } from '../timezone/TimezoneManager.js';
|
|
5
|
+
/**
|
|
6
|
+
* Calendar - Main calendar class with full timezone support
|
|
7
|
+
* Pure JavaScript, no DOM dependencies
|
|
8
|
+
* Framework agnostic, Locker Service compatible
|
|
9
|
+
*/
|
|
10
|
+
export declare class Calendar {
|
|
11
|
+
timezoneManager: TimezoneManager;
|
|
12
|
+
config: {
|
|
13
|
+
events?: import("../types.js").EventData[];
|
|
14
|
+
view: string;
|
|
15
|
+
date: Date;
|
|
16
|
+
weekStartsOn: number;
|
|
17
|
+
locale: string;
|
|
18
|
+
timeZone: string;
|
|
19
|
+
showWeekNumbers: boolean;
|
|
20
|
+
showWeekends: boolean;
|
|
21
|
+
fixedWeekCount: boolean;
|
|
22
|
+
businessHours: {
|
|
23
|
+
start: string;
|
|
24
|
+
end: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
eventStore: EventStore;
|
|
28
|
+
state: StateManager;
|
|
29
|
+
listeners: Map<any, any>;
|
|
30
|
+
plugins: Set<any>;
|
|
31
|
+
views: Map<any, any>;
|
|
32
|
+
/**
|
|
33
|
+
* Create a new Calendar instance
|
|
34
|
+
* @param {import('../types.js').CalendarConfig} [config={}] - Configuration options
|
|
35
|
+
*/
|
|
36
|
+
constructor(config?: import('../types.js').CalendarConfig);
|
|
37
|
+
/**
|
|
38
|
+
* Set the calendar view
|
|
39
|
+
* @param {import('../types.js').ViewType} viewType - The view type ('month', 'week', 'day', 'list')
|
|
40
|
+
* @param {Date} [date=null] - Optional date to navigate to
|
|
41
|
+
*/
|
|
42
|
+
setView(viewType: import('../types.js').ViewType, date?: Date): void;
|
|
43
|
+
/**
|
|
44
|
+
* Get the current view type
|
|
45
|
+
* @returns {import('../types.js').ViewType} The current view type
|
|
46
|
+
*/
|
|
47
|
+
getView(): import('../types.js').ViewType;
|
|
48
|
+
/**
|
|
49
|
+
* Navigate to the next period
|
|
50
|
+
*/
|
|
51
|
+
next(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Navigate to the previous period
|
|
54
|
+
*/
|
|
55
|
+
previous(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Navigate to today
|
|
58
|
+
*/
|
|
59
|
+
today(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Navigate to a specific date
|
|
62
|
+
* @param {Date} date - The date to navigate to
|
|
63
|
+
*/
|
|
64
|
+
goToDate(date: Date): void;
|
|
65
|
+
/**
|
|
66
|
+
* Alias for goToDate (compat)
|
|
67
|
+
* @param {Date} date - The date to navigate to
|
|
68
|
+
*/
|
|
69
|
+
setDate(date: Date): void;
|
|
70
|
+
/**
|
|
71
|
+
* Get the current date
|
|
72
|
+
* @returns {Date}
|
|
73
|
+
*/
|
|
74
|
+
getCurrentDate(): Date;
|
|
75
|
+
/**
|
|
76
|
+
* Add an event
|
|
77
|
+
* @param {import('../events/Event.js').Event|import('../types.js').EventData} eventData - Event data or Event instance
|
|
78
|
+
* @returns {import('../events/Event.js').Event} The added event
|
|
79
|
+
*/
|
|
80
|
+
addEvent(eventData: import('../events/Event.js').Event | import('../types.js').EventData): import('../events/Event.js').Event;
|
|
81
|
+
/**
|
|
82
|
+
* Update an event
|
|
83
|
+
* @param {string} eventId - The event ID
|
|
84
|
+
* @param {Object} updates - Properties to update
|
|
85
|
+
* @returns {Event} The updated event
|
|
86
|
+
*/
|
|
87
|
+
updateEvent(eventId: string, updates: Object): Event;
|
|
88
|
+
/**
|
|
89
|
+
* Remove an event
|
|
90
|
+
* @param {string} eventId - The event ID
|
|
91
|
+
* @returns {boolean} True if removed
|
|
92
|
+
*/
|
|
93
|
+
removeEvent(eventId: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Alias for removeEvent (compat)
|
|
96
|
+
* @param {string} eventId - The event ID
|
|
97
|
+
* @returns {boolean} True if removed
|
|
98
|
+
*/
|
|
99
|
+
deleteEvent(eventId: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Get an event by ID
|
|
102
|
+
* @param {string} eventId - The event ID
|
|
103
|
+
* @returns {Event|null}
|
|
104
|
+
*/
|
|
105
|
+
getEvent(eventId: string): Event | null;
|
|
106
|
+
/**
|
|
107
|
+
* Get all events
|
|
108
|
+
* @returns {Event[]}
|
|
109
|
+
*/
|
|
110
|
+
getEvents(): Event[];
|
|
111
|
+
/**
|
|
112
|
+
* Set all events (replaces existing)
|
|
113
|
+
* @param {Event[]} events - Array of events
|
|
114
|
+
*/
|
|
115
|
+
setEvents(events: Event[]): void;
|
|
116
|
+
/**
|
|
117
|
+
* Query events with filters
|
|
118
|
+
* @param {Object} filters - Query filters
|
|
119
|
+
* @returns {Event[]}
|
|
120
|
+
*/
|
|
121
|
+
queryEvents(filters: Object): Event[];
|
|
122
|
+
/**
|
|
123
|
+
* Get events for a specific date
|
|
124
|
+
* @param {Date} date - The date
|
|
125
|
+
* @param {string} [timezone] - Timezone for the query (defaults to calendar timezone)
|
|
126
|
+
* @returns {Event[]}
|
|
127
|
+
*/
|
|
128
|
+
getEventsForDate(date: Date, timezone?: string): Event[];
|
|
129
|
+
/**
|
|
130
|
+
* Get events in a date range
|
|
131
|
+
* @param {Date} start - Start date
|
|
132
|
+
* @param {Date} end - End date
|
|
133
|
+
* @param {string} [timezone] - Timezone for the query (defaults to calendar timezone)
|
|
134
|
+
* @returns {Event[]}
|
|
135
|
+
*/
|
|
136
|
+
getEventsInRange(start: Date, end: Date, timezone?: string): Event[];
|
|
137
|
+
/**
|
|
138
|
+
* Set the calendar's timezone
|
|
139
|
+
* @param {string} timezone - IANA timezone identifier
|
|
140
|
+
*/
|
|
141
|
+
setTimezone(timezone: string): void;
|
|
142
|
+
/**
|
|
143
|
+
* Get the current timezone
|
|
144
|
+
* @returns {string} Current timezone
|
|
145
|
+
*/
|
|
146
|
+
getTimezone(): string;
|
|
147
|
+
/**
|
|
148
|
+
* Set the calendar locale
|
|
149
|
+
* @param {string} locale - Locale identifier (e.g. 'en-US')
|
|
150
|
+
*/
|
|
151
|
+
setLocale(locale: string): void;
|
|
152
|
+
/**
|
|
153
|
+
* Set the week start day
|
|
154
|
+
* @param {number} weekStartsOn - 0 = Sunday, 1 = Monday, etc.
|
|
155
|
+
*/
|
|
156
|
+
setWeekStartsOn(weekStartsOn: number): void;
|
|
157
|
+
/**
|
|
158
|
+
* Convert a date from one timezone to another
|
|
159
|
+
* @param {Date} date - Date to convert
|
|
160
|
+
* @param {string} fromTimezone - Source timezone
|
|
161
|
+
* @param {string} toTimezone - Target timezone
|
|
162
|
+
* @returns {Date} Converted date
|
|
163
|
+
*/
|
|
164
|
+
convertTimezone(date: Date, fromTimezone: string, toTimezone: string): Date;
|
|
165
|
+
/**
|
|
166
|
+
* Convert a date to the calendar's timezone
|
|
167
|
+
* @param {Date} date - Date to convert
|
|
168
|
+
* @param {string} fromTimezone - Source timezone
|
|
169
|
+
* @returns {Date} Date in calendar timezone
|
|
170
|
+
*/
|
|
171
|
+
toCalendarTimezone(date: Date, fromTimezone: string): Date;
|
|
172
|
+
/**
|
|
173
|
+
* Convert a date from the calendar's timezone
|
|
174
|
+
* @param {Date} date - Date in calendar timezone
|
|
175
|
+
* @param {string} toTimezone - Target timezone
|
|
176
|
+
* @returns {Date} Converted date
|
|
177
|
+
*/
|
|
178
|
+
fromCalendarTimezone(date: Date, toTimezone: string): Date;
|
|
179
|
+
/**
|
|
180
|
+
* Format a date in a specific timezone
|
|
181
|
+
* @param {Date} date - Date to format
|
|
182
|
+
* @param {string} [timezone] - Timezone for formatting (defaults to calendar timezone)
|
|
183
|
+
* @param {Object} [options] - Formatting options
|
|
184
|
+
* @returns {string} Formatted date string
|
|
185
|
+
*/
|
|
186
|
+
formatInTimezone(date: Date, timezone?: string, options?: Object): string;
|
|
187
|
+
/**
|
|
188
|
+
* Get list of common timezones with offsets
|
|
189
|
+
* @returns {Array<{value: string, label: string, offset: string}>} Timezone list
|
|
190
|
+
*/
|
|
191
|
+
getTimezones(): Array<{
|
|
192
|
+
value: string;
|
|
193
|
+
label: string;
|
|
194
|
+
offset: string;
|
|
195
|
+
}>;
|
|
196
|
+
/**
|
|
197
|
+
* Get overlapping event groups for a date
|
|
198
|
+
* @param {Date} date - The date to check
|
|
199
|
+
* @param {boolean} timedOnly - Only include timed events
|
|
200
|
+
* @returns {Array<Event[]>} Array of event groups that overlap
|
|
201
|
+
*/
|
|
202
|
+
getOverlapGroups(date: Date, timedOnly?: boolean): Array<Event[]>;
|
|
203
|
+
/**
|
|
204
|
+
* Calculate event positions for rendering
|
|
205
|
+
* @param {Event[]} events - Array of overlapping events
|
|
206
|
+
* @returns {Map<string, {column: number, totalColumns: number}>} Position data
|
|
207
|
+
*/
|
|
208
|
+
calculateEventPositions(events: Event[]): Map<string, {
|
|
209
|
+
column: number;
|
|
210
|
+
totalColumns: number;
|
|
211
|
+
}>;
|
|
212
|
+
/**
|
|
213
|
+
* Get the current view's data
|
|
214
|
+
* @returns {import('../types.js').MonthViewData|import('../types.js').WeekViewData|import('../types.js').DayViewData|import('../types.js').ListViewData|null} View-specific data
|
|
215
|
+
*/
|
|
216
|
+
getViewData(): import('../types.js').MonthViewData | import('../types.js').WeekViewData | import('../types.js').DayViewData | import('../types.js').ListViewData | null;
|
|
217
|
+
/**
|
|
218
|
+
* Get month view data
|
|
219
|
+
* @private
|
|
220
|
+
*/
|
|
221
|
+
private _getMonthViewData;
|
|
222
|
+
/**
|
|
223
|
+
* Get week view data
|
|
224
|
+
* @private
|
|
225
|
+
*/
|
|
226
|
+
private _getWeekViewData;
|
|
227
|
+
/**
|
|
228
|
+
* Get day view data
|
|
229
|
+
* @private
|
|
230
|
+
*/
|
|
231
|
+
private _getDayViewData;
|
|
232
|
+
/**
|
|
233
|
+
* Get list view data
|
|
234
|
+
* @private
|
|
235
|
+
*/
|
|
236
|
+
private _getListViewData;
|
|
237
|
+
/**
|
|
238
|
+
* Select an event
|
|
239
|
+
* @param {string} eventId - Event ID to select
|
|
240
|
+
*/
|
|
241
|
+
selectEvent(eventId: string): void;
|
|
242
|
+
/**
|
|
243
|
+
* Clear event selection
|
|
244
|
+
*/
|
|
245
|
+
clearEventSelection(): void;
|
|
246
|
+
/**
|
|
247
|
+
* Select a date
|
|
248
|
+
* @param {Date} date - Date to select
|
|
249
|
+
*/
|
|
250
|
+
selectDate(date: Date): void;
|
|
251
|
+
/**
|
|
252
|
+
* Clear date selection
|
|
253
|
+
*/
|
|
254
|
+
clearDateSelection(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Subscribe to calendar events
|
|
257
|
+
* @param {string} eventName - Event name
|
|
258
|
+
* @param {Function} callback - Callback function
|
|
259
|
+
* @returns {Function} Unsubscribe function
|
|
260
|
+
*/
|
|
261
|
+
on(eventName: string, callback: Function): Function;
|
|
262
|
+
/**
|
|
263
|
+
* Unsubscribe from calendar events
|
|
264
|
+
* @param {string} eventName - Event name
|
|
265
|
+
* @param {Function} callback - Callback function
|
|
266
|
+
*/
|
|
267
|
+
off(eventName: string, callback: Function): void;
|
|
268
|
+
/**
|
|
269
|
+
* Emit an event
|
|
270
|
+
* @private
|
|
271
|
+
*/
|
|
272
|
+
private _emit;
|
|
273
|
+
/**
|
|
274
|
+
* Set up internal listeners
|
|
275
|
+
* @private
|
|
276
|
+
*/
|
|
277
|
+
private _setupInternalListeners;
|
|
278
|
+
/**
|
|
279
|
+
* Install a plugin
|
|
280
|
+
* @param {Object} plugin - Plugin object with install method
|
|
281
|
+
*/
|
|
282
|
+
use(plugin: Object): void;
|
|
283
|
+
/**
|
|
284
|
+
* Destroy the calendar and clean up
|
|
285
|
+
*/
|
|
286
|
+
destroy(): void;
|
|
287
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DateUtils - Date manipulation utilities
|
|
3
|
+
* Pure functions, no external dependencies
|
|
4
|
+
* Locker Service compatible
|
|
5
|
+
*/
|
|
6
|
+
export declare class DateUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Get the start of a day
|
|
9
|
+
* @param {Date} date - The date
|
|
10
|
+
* @returns {Date}
|
|
11
|
+
*/
|
|
12
|
+
static startOfDay(date: Date): Date;
|
|
13
|
+
/**
|
|
14
|
+
* Get the end of a day
|
|
15
|
+
* @param {Date} date - The date
|
|
16
|
+
* @returns {Date}
|
|
17
|
+
*/
|
|
18
|
+
static endOfDay(date: Date): Date;
|
|
19
|
+
/**
|
|
20
|
+
* Get the start of a week
|
|
21
|
+
* @param {Date} date - The date
|
|
22
|
+
* @param {number} [weekStartsOn=0] - 0 = Sunday, 1 = Monday, etc.
|
|
23
|
+
* @returns {Date} Start of the week
|
|
24
|
+
*/
|
|
25
|
+
static startOfWeek(date: Date, weekStartsOn?: number): Date;
|
|
26
|
+
/**
|
|
27
|
+
* Get the end of a week
|
|
28
|
+
* @param {Date} date - The date
|
|
29
|
+
* @param {number} weekStartsOn - 0 = Sunday, 1 = Monday, etc.
|
|
30
|
+
* @returns {Date}
|
|
31
|
+
*/
|
|
32
|
+
static endOfWeek(date: Date, weekStartsOn?: number): Date;
|
|
33
|
+
/**
|
|
34
|
+
* Get the start of a month
|
|
35
|
+
* @param {Date} date - The date
|
|
36
|
+
* @returns {Date}
|
|
37
|
+
*/
|
|
38
|
+
static startOfMonth(date: Date): Date;
|
|
39
|
+
/**
|
|
40
|
+
* Get the end of a month
|
|
41
|
+
* @param {Date} date - The date
|
|
42
|
+
* @returns {Date}
|
|
43
|
+
*/
|
|
44
|
+
static endOfMonth(date: Date): Date;
|
|
45
|
+
/**
|
|
46
|
+
* Get the start of a year
|
|
47
|
+
* @param {Date} date - The date
|
|
48
|
+
* @returns {Date}
|
|
49
|
+
*/
|
|
50
|
+
static startOfYear(date: Date): Date;
|
|
51
|
+
/**
|
|
52
|
+
* Get the end of a year
|
|
53
|
+
* @param {Date} date - The date
|
|
54
|
+
* @returns {Date}
|
|
55
|
+
*/
|
|
56
|
+
static endOfYear(date: Date): Date;
|
|
57
|
+
/**
|
|
58
|
+
* Add days to a date
|
|
59
|
+
* @param {Date} date - The date
|
|
60
|
+
* @param {number} days - Number of days to add (can be negative)
|
|
61
|
+
* @returns {Date}
|
|
62
|
+
*/
|
|
63
|
+
static addDays(date: Date, days: number): Date;
|
|
64
|
+
/**
|
|
65
|
+
* Add weeks to a date
|
|
66
|
+
* @param {Date} date - The date
|
|
67
|
+
* @param {number} weeks - Number of weeks to add
|
|
68
|
+
* @returns {Date}
|
|
69
|
+
*/
|
|
70
|
+
static addWeeks(date: Date, weeks: number): Date;
|
|
71
|
+
/**
|
|
72
|
+
* Add months to a date
|
|
73
|
+
* @param {Date} date - The date
|
|
74
|
+
* @param {number} months - Number of months to add
|
|
75
|
+
* @returns {Date}
|
|
76
|
+
*/
|
|
77
|
+
static addMonths(date: Date, months: number): Date;
|
|
78
|
+
/**
|
|
79
|
+
* Add years to a date
|
|
80
|
+
* @param {Date} date - The date
|
|
81
|
+
* @param {number} years - Number of years to add
|
|
82
|
+
* @returns {Date}
|
|
83
|
+
*/
|
|
84
|
+
static addYears(date: Date, years: number): Date;
|
|
85
|
+
/**
|
|
86
|
+
* Get a consistent UTC date string for indexing (YYYY-MM-DD format)
|
|
87
|
+
* @param {Date} date - The date
|
|
88
|
+
* @returns {string} UTC date string
|
|
89
|
+
*/
|
|
90
|
+
static getUTCDateString(date: Date): string;
|
|
91
|
+
/**
|
|
92
|
+
* Get a consistent local date string for indexing (YYYY-MM-DD format)
|
|
93
|
+
* @param {Date} date - The date
|
|
94
|
+
* @returns {string} Local date string
|
|
95
|
+
*/
|
|
96
|
+
static getLocalDateString(date: Date): string;
|
|
97
|
+
/**
|
|
98
|
+
* Check if a date is today
|
|
99
|
+
* @param {Date} date - The date to check
|
|
100
|
+
* @returns {boolean}
|
|
101
|
+
*/
|
|
102
|
+
static isToday(date: Date): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Check if a date is in the past
|
|
105
|
+
* @param {Date} date - The date to check
|
|
106
|
+
* @returns {boolean}
|
|
107
|
+
*/
|
|
108
|
+
static isPast(date: Date): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Check if a date is in the future
|
|
111
|
+
* @param {Date} date - The date to check
|
|
112
|
+
* @returns {boolean}
|
|
113
|
+
*/
|
|
114
|
+
static isFuture(date: Date): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Check if two dates are on the same day
|
|
117
|
+
* @param {Date} date1 - First date
|
|
118
|
+
* @param {Date} date2 - Second date
|
|
119
|
+
* @returns {boolean}
|
|
120
|
+
*/
|
|
121
|
+
static isSameDay(date1: Date, date2: Date): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Check if two dates are in the same week
|
|
124
|
+
* @param {Date} date1 - First date
|
|
125
|
+
* @param {Date} date2 - Second date
|
|
126
|
+
* @param {number} weekStartsOn - 0 = Sunday, 1 = Monday, etc.
|
|
127
|
+
* @returns {boolean}
|
|
128
|
+
*/
|
|
129
|
+
static isSameWeek(date1: Date, date2: Date, weekStartsOn?: number): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Check if two dates are in the same month
|
|
132
|
+
* @param {Date} date1 - First date
|
|
133
|
+
* @param {Date} date2 - Second date
|
|
134
|
+
* @returns {boolean}
|
|
135
|
+
*/
|
|
136
|
+
static isSameMonth(date1: Date, date2: Date): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Check if two dates are in the same year
|
|
139
|
+
* @param {Date} date1 - First date
|
|
140
|
+
* @param {Date} date2 - Second date
|
|
141
|
+
* @returns {boolean}
|
|
142
|
+
*/
|
|
143
|
+
static isSameYear(date1: Date, date2: Date): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Get the difference in days between two dates
|
|
146
|
+
* @param {Date} date1 - First date
|
|
147
|
+
* @param {Date} date2 - Second date
|
|
148
|
+
* @returns {number}
|
|
149
|
+
*/
|
|
150
|
+
static differenceInDays(date1: Date, date2: Date): number;
|
|
151
|
+
/**
|
|
152
|
+
* Get the difference in weeks between two dates
|
|
153
|
+
* @param {Date} date1 - First date
|
|
154
|
+
* @param {Date} date2 - Second date
|
|
155
|
+
* @returns {number}
|
|
156
|
+
*/
|
|
157
|
+
static differenceInWeeks(date1: Date, date2: Date): number;
|
|
158
|
+
/**
|
|
159
|
+
* Get the difference in months between two dates
|
|
160
|
+
* @param {Date} date1 - First date
|
|
161
|
+
* @param {Date} date2 - Second date
|
|
162
|
+
* @returns {number}
|
|
163
|
+
*/
|
|
164
|
+
static differenceInMonths(date1: Date, date2: Date): number;
|
|
165
|
+
/**
|
|
166
|
+
* Get the week number of a date
|
|
167
|
+
* @param {Date} date - The date
|
|
168
|
+
* @returns {number}
|
|
169
|
+
*/
|
|
170
|
+
static getWeekNumber(date: Date): number;
|
|
171
|
+
/**
|
|
172
|
+
* Get the day of week for a date
|
|
173
|
+
* @param {Date} date - The date
|
|
174
|
+
* @param {number} weekStartsOn - 0 = Sunday, 1 = Monday, etc.
|
|
175
|
+
* @returns {number} 0-6 where 0 is the first day of the week
|
|
176
|
+
*/
|
|
177
|
+
static getDayOfWeek(date: Date, weekStartsOn?: number): number;
|
|
178
|
+
/**
|
|
179
|
+
* Get days in a month
|
|
180
|
+
* @param {Date} date - Any date in the month
|
|
181
|
+
* @returns {number}
|
|
182
|
+
*/
|
|
183
|
+
static getDaysInMonth(date: Date): number;
|
|
184
|
+
/**
|
|
185
|
+
* Format a date using Intl.DateTimeFormat
|
|
186
|
+
* @param {Date} date - The date to format
|
|
187
|
+
* @param {string} locale - The locale
|
|
188
|
+
* @param {Object} options - Intl.DateTimeFormat options
|
|
189
|
+
* @returns {string}
|
|
190
|
+
*/
|
|
191
|
+
static format(date: Date, locale?: string, options?: Object): string;
|
|
192
|
+
/**
|
|
193
|
+
* Get month name
|
|
194
|
+
* @param {Date} date - The date
|
|
195
|
+
* @param {string} locale - The locale
|
|
196
|
+
* @param {string} format - 'long', 'short', or 'narrow'
|
|
197
|
+
* @returns {string}
|
|
198
|
+
*/
|
|
199
|
+
static getMonthName(date: Date, locale?: string, format?: string): string;
|
|
200
|
+
/**
|
|
201
|
+
* Get day name
|
|
202
|
+
* @param {Date} date - The date
|
|
203
|
+
* @param {string} locale - The locale
|
|
204
|
+
* @param {string} format - 'long', 'short', or 'narrow'
|
|
205
|
+
* @returns {string}
|
|
206
|
+
*/
|
|
207
|
+
static getDayName(date: Date, locale?: string, format?: string): string;
|
|
208
|
+
/**
|
|
209
|
+
* Format time
|
|
210
|
+
* @param {Date} date - The date
|
|
211
|
+
* @param {string} locale - The locale
|
|
212
|
+
* @param {boolean} use24Hour - Use 24-hour format
|
|
213
|
+
* @returns {string}
|
|
214
|
+
*/
|
|
215
|
+
static formatTime(date: Date, locale?: string, use24Hour?: boolean): string;
|
|
216
|
+
/**
|
|
217
|
+
* Parse a time string (HH:MM) to hours and minutes
|
|
218
|
+
* @param {string} timeString - Time string like "09:30"
|
|
219
|
+
* @returns {{hours: number, minutes: number}}
|
|
220
|
+
*/
|
|
221
|
+
static parseTime(timeString: string): {
|
|
222
|
+
hours: number;
|
|
223
|
+
minutes: number;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Set time on a date
|
|
227
|
+
* @param {Date} date - The date
|
|
228
|
+
* @param {string} timeString - Time string like "09:30"
|
|
229
|
+
* @returns {Date}
|
|
230
|
+
*/
|
|
231
|
+
static setTime(date: Date, timeString: string): Date;
|
|
232
|
+
/**
|
|
233
|
+
* Check if a year is a leap year
|
|
234
|
+
* @param {number} year - The year
|
|
235
|
+
* @returns {boolean}
|
|
236
|
+
*/
|
|
237
|
+
static isLeapYear(year: number): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Get an array of dates between start and end
|
|
240
|
+
* @param {Date} start - Start date
|
|
241
|
+
* @param {Date} end - End date
|
|
242
|
+
* @returns {Date[]}
|
|
243
|
+
*/
|
|
244
|
+
static getDateRange(start: Date, end: Date): Date[];
|
|
245
|
+
/**
|
|
246
|
+
* Clone a date
|
|
247
|
+
* @param {Date} date - The date to clone
|
|
248
|
+
* @returns {Date}
|
|
249
|
+
*/
|
|
250
|
+
static clone(date: Date): Date;
|
|
251
|
+
/**
|
|
252
|
+
* Validate if a value is a valid date
|
|
253
|
+
* @param {*} value - Value to check
|
|
254
|
+
* @returns {boolean}
|
|
255
|
+
*/
|
|
256
|
+
static isValidDate(value: any): boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Convert a date to a specific timezone
|
|
259
|
+
* @param {Date} date - The date to convert
|
|
260
|
+
* @param {string} timeZone - IANA timezone string (e.g., 'America/New_York')
|
|
261
|
+
* @returns {Date} - Date object adjusted for timezone
|
|
262
|
+
*/
|
|
263
|
+
static toTimeZone(date: Date, timeZone: string): Date;
|
|
264
|
+
/**
|
|
265
|
+
* Get timezone offset in minutes for a date
|
|
266
|
+
* @param {Date} date - The date
|
|
267
|
+
* @param {string} timeZone - IANA timezone string
|
|
268
|
+
* @returns {number} - Offset in minutes
|
|
269
|
+
*/
|
|
270
|
+
static getTimezoneOffset(date: Date, timeZone: string): number;
|
|
271
|
+
/**
|
|
272
|
+
* Check if DST is in effect for a date in a timezone
|
|
273
|
+
* @param {Date} date - The date to check
|
|
274
|
+
* @param {string} timeZone - IANA timezone string
|
|
275
|
+
* @returns {boolean}
|
|
276
|
+
*/
|
|
277
|
+
static isDST(date: Date, timeZone: string): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Add time accounting for DST transitions
|
|
280
|
+
* @param {Date} date - The date
|
|
281
|
+
* @param {number} hours - Hours to add
|
|
282
|
+
* @param {string} timeZone - IANA timezone string
|
|
283
|
+
* @returns {Date}
|
|
284
|
+
*/
|
|
285
|
+
static addHoursWithDST(date: Date, hours: number, _timeZone: any): Date;
|
|
286
|
+
/**
|
|
287
|
+
* Create a date in a specific timezone
|
|
288
|
+
* @param {number} year
|
|
289
|
+
* @param {number} month - 0-indexed
|
|
290
|
+
* @param {number} day
|
|
291
|
+
* @param {number} hour
|
|
292
|
+
* @param {number} minute
|
|
293
|
+
* @param {number} second
|
|
294
|
+
* @param {string} timeZone - IANA timezone string
|
|
295
|
+
* @returns {Date}
|
|
296
|
+
*/
|
|
297
|
+
static createInTimeZone(year: number, month: number, day: number, hour: number | undefined, minute: number | undefined, second: number | undefined, timeZone: string): Date;
|
|
298
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConflictDetector - Detects scheduling conflicts between events
|
|
3
|
+
* Checks for time overlaps, attendee conflicts, and resource conflicts
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConflictDetector {
|
|
6
|
+
eventStore: import("../index.js").EventStore;
|
|
7
|
+
conflictIdCounter: number;
|
|
8
|
+
/**
|
|
9
|
+
* Create a new ConflictDetector
|
|
10
|
+
* @param {import('../events/EventStore.js').EventStore} eventStore - Event store instance
|
|
11
|
+
*/
|
|
12
|
+
constructor(eventStore: import('../events/EventStore.js').EventStore);
|
|
13
|
+
/**
|
|
14
|
+
* Check for conflicts for a specific event
|
|
15
|
+
* @param {import('../events/Event.js').Event|import('../types.js').EventData} event - Event to check
|
|
16
|
+
* @param {import('../types.js').ConflictCheckOptions} [options={}] - Check options
|
|
17
|
+
* @returns {import('../types.js').ConflictSummary} Conflict summary
|
|
18
|
+
*/
|
|
19
|
+
checkConflicts(event: import('../events/Event.js').Event | import('../types.js').EventData, options?: import('../types.js').ConflictCheckOptions): import('../types.js').ConflictSummary;
|
|
20
|
+
/**
|
|
21
|
+
* Check for conflicts between two specific events
|
|
22
|
+
* @param {import('../events/Event.js').Event} event1 - First event
|
|
23
|
+
* @param {import('../events/Event.js').Event} event2 - Second event
|
|
24
|
+
* @param {import('../types.js').ConflictCheckOptions} [options={}] - Check options
|
|
25
|
+
* @returns {import('../types.js').ConflictDetails[]} Array of conflicts
|
|
26
|
+
*/
|
|
27
|
+
checkEventPairConflicts(event1: import('../events/Event.js').Event, event2: import('../events/Event.js').Event, options?: import('../types.js').ConflictCheckOptions): import('../types.js').ConflictDetails[];
|
|
28
|
+
/**
|
|
29
|
+
* Get busy periods for a set of attendees
|
|
30
|
+
* @param {string[]} attendeeEmails - Attendee email addresses
|
|
31
|
+
* @param {Date} start - Start of period
|
|
32
|
+
* @param {Date} end - End of period
|
|
33
|
+
* @param {Object} [options={}] - Options
|
|
34
|
+
* @returns {Array<{start: Date, end: Date, eventIds: string[]}>} Busy periods
|
|
35
|
+
*/
|
|
36
|
+
getBusyPeriods(attendeeEmails: string[], start: Date, end: Date, options?: Object): Array<{
|
|
37
|
+
start: Date;
|
|
38
|
+
end: Date;
|
|
39
|
+
eventIds: string[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Get free time slots
|
|
43
|
+
* @param {Date} start - Start of search period
|
|
44
|
+
* @param {Date} end - End of search period
|
|
45
|
+
* @param {number} duration - Required duration in minutes
|
|
46
|
+
* @param {Object} [options={}] - Options
|
|
47
|
+
* @returns {Array<{start: Date, end: Date}>} Free time slots
|
|
48
|
+
*/
|
|
49
|
+
getFreePeriods(start: Date, end: Date, duration: number, options?: Object): Array<{
|
|
50
|
+
start: Date;
|
|
51
|
+
end: Date;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Detect conflicts between two events
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
private _detectEventConflicts;
|
|
58
|
+
/**
|
|
59
|
+
* Check for time overlap between events
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
private _checkTimeOverlap;
|
|
63
|
+
/**
|
|
64
|
+
* Create time conflict details
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
private _createTimeConflict;
|
|
68
|
+
/**
|
|
69
|
+
* Check for attendee conflicts
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
private _checkAttendeeConflicts;
|
|
73
|
+
/**
|
|
74
|
+
* Check for resource conflicts
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
private _checkResourceConflicts;
|
|
78
|
+
/**
|
|
79
|
+
* Check for location conflicts
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
private _checkLocationConflict;
|
|
83
|
+
/**
|
|
84
|
+
* Build conflict summary
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private _buildConflictSummary;
|
|
88
|
+
/**
|
|
89
|
+
* Merge overlapping busy periods
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
private _mergeBusyPeriods;
|
|
93
|
+
/**
|
|
94
|
+
* Get all busy periods
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private _getAllBusyPeriods;
|
|
98
|
+
/**
|
|
99
|
+
* Check if time period is within business hours
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
private _isWithinBusinessHours;
|
|
103
|
+
}
|