Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jho44 committed Aug 8, 2023
1 parent ad77dff commit a5b8362
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/lib/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ export const toUTC = (d: Date, timeZone: string) => {
return new Date(localDatetime.toUTC().toString());
};

export const toLocalTimezone = (date: Date, timeZone: string) =>
new Date(date.toLocaleString('en-US', { timeZone }));
export const toLocalTimezone = (date: Date, timeZone: string) => {
console.log('start with', date);
console.log('local date str', date.toLocaleString('en-US', { timeZone }), timeZone);
return new Date(date.toLocaleString('en-US', { timeZone }));
};
11 changes: 10 additions & 1 deletion src/lib/server/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,19 @@ async function saveUser(
d.setDate(diff);
d.setHours(notifHr);
d.setMinutes(notifMin);
console.log({
date: d.getDate(),
notifFreq,
timeZone,
diff,
notifStartDay,
notifHr,
notifMin
});
console.log('local date', d);

// convert to UTC in the end
const utcReminderDate = toUTC(d, timeZone);
console.log('local date', d);
console.log('utc date', utcReminderDate);
const baseUser = {
locale,
Expand Down

0 comments on commit a5b8362

Please sign in to comment.