Skip to content

Commit

Permalink
Fix timezone issue for filtering routes
Browse files Browse the repository at this point in the history
  • Loading branch information
chunlaw committed Oct 25, 2023
1 parent 87677ab commit e381526
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/timetable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ export const isRouteAvaliable = (
if (!freq) return true;
let isAvailable = false;
let now = new Date();
now.setTime(now.getTime() + 8 * 60 * 60 * 1000);
let currentWts = getWeeklyTimestamp(
isHoliday ? 0 : now.getDay(),
("0" + now.getHours()).slice(-2) + ("0" + now.getMinutes()).slice(-2)
isHoliday ? 0 : now.getUTCDay(),
("0" + now.getUTCHours()).slice(-2) + ("0" + now.getUTCMinutes()).slice(-2)
);
Object.entries(freq).forEach(([serviceId, startTimes]) => {
try {
Expand Down

0 comments on commit e381526

Please sign in to comment.