-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Rename FcDate and FcEvent types
- Loading branch information
1 parent
4a7f85b
commit acb634a
Showing
29 changed files
with
294 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
export class API {} | ||
import type { Calendar, CalDate, CalEvent } from "src/@types"; | ||
import { CalendarStore } from "src/stores/calendar.store"; | ||
import { get } from "svelte/store"; | ||
|
||
export class API { | ||
#store: CalendarStore; | ||
#object: Calendar; | ||
constructor(store: CalendarStore) { | ||
this.#store = store; | ||
} | ||
|
||
/** | ||
* Transform a day, month, year definition into a CalDate | ||
* @param day Day number | ||
* @param month Month number (0 indexed) | ||
* @param year Year number | ||
* @returns {CalDate} | ||
*/ | ||
getDate(day: number, month: number, year: number): CalDate { | ||
return { day, month, year }; | ||
} | ||
|
||
/** Get all events for the loaded calendar. */ | ||
getEvents(): CalEvent[] { | ||
return get(this.#store.eventCache.entities); | ||
} | ||
/** Get all events on a specific date. */ | ||
getEventsOnDay(day: CalDate): CalEvent[] { | ||
return get(this.#store.eventCache.getItemsOrRecalculate(day)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.