Skip to content

Commit

Permalink
Fix: Also convert dates for comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell committed Jul 25, 2023
1 parent 1d95f51 commit 1828b7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gmp/models/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class Event {
while (true && retries <= 5) {
try {
const next = it.next();
if (next.toUnixTime() >= now.unix()) {
if (convertIcalDate(next, this.timezone).unix() >= now.unix()) {
return convertIcalDate(next, this.timezone);
}
retries = 0;
Expand All @@ -380,8 +380,9 @@ class Event {
// the event is not recurring
// it should only occur once on its start date
const now = date();
const start = convertIcalDate(this.event.startDate, this.timezone);

if (this.event.startDate.toUnixTime() >= now.unix()) {
if (start.unix() >= now.unix()) {
return convertIcalDate(this.event.startDate, this.timezone);
}
}
Expand Down

0 comments on commit 1828b7a

Please sign in to comment.