Skip to content

Commit

Permalink
Update date at midnight #16
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiGasai committed Oct 20, 2022
1 parent 3bf49e2 commit 030e766
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "google-calendar",
"name": "Google Calendar",
"version": "1.5.0",
"version": "1.5.1",
"minAppVersion": "0.12.0",
"description": "Interact with your Google Calendar from Inside Obsidian",
"author": "YukiGasai",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "google-calendar",
"version": "1.5.0",
"version": "1.5.1",
"description": "Interact with your Google Calendar from Inside Obsidian",
"main": "main.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/modal/EventListModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export class EventListModal extends FuzzySuggestModal<GoogleEvent> {
closeFunction?: () => void
) {
super(GoogleCalendarPlugin.getInstance().app);
this.eventList = eventList;
this.eventList = [...eventList];
this.setPlaceholder(`${currentDate.format("MM/DD/YYYY")} Arrow left/right to switch day`);
this.emptyStateText = "No events found enter to create a new one"
this.eventsChanged = eventsChanged;
this.currentDate = currentDate;
this.currentDate = currentDate.clone();
if(closeFunction){
this.closeFunction = closeFunction
}
Expand Down Expand Up @@ -65,9 +65,9 @@ export class EventListModal extends FuzzySuggestModal<GoogleEvent> {

if(dateUpdated){
this.setPlaceholder("Loading");
this.eventList = await googleListEvents({startDate:currentDate});
this.eventList = await googleListEvents({startDate:this.currentDate});
this.inputEl.dispatchEvent(new Event('input'));
this.setPlaceholder(`${currentDate.format("MM/DD/YYYY")} Arrow left and right to switch day`);
this.setPlaceholder(`${this.currentDate.format("MM/DD/YYYY")} Arrow left and right to switch day`);
}
})
}
Expand Down
6 changes: 5 additions & 1 deletion src/svelte/CalendarComp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
let events: GoogleEvent[];
let loading: boolean = true;
let sources:ICalendarSource[];
let today = window.moment();
async function getSource(month:moment.Moment) {
today = window.moment();
const prevMonthDate = month.clone().subtract(1, "month").startOf("month");
const nextMonthDate = month.clone().add(1, "month").endOf("month");
Expand Down Expand Up @@ -78,7 +80,7 @@
if(interval){
clearInterval(interval);
}
interval = setInterval(() => getSource(displayedMonth), 5000)
interval = setInterval(() => getSource(displayedMonth), 10000)
getSource(displayedMonth)
}
Expand All @@ -100,6 +102,7 @@
{onClickDay}
bind:sources
bind:displayedMonth
bind:today
/>
</div>
{/if}
Expand All @@ -120,6 +123,7 @@
{onClickDay}
bind:sources
bind:displayedMonth
bind:today
/>
</div>
{/if}
Expand Down

0 comments on commit 030e766

Please sign in to comment.