Skip to content

Commit

Permalink
fix: crazy JS date (#3148)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashpatil78 committed Jul 15, 2024
1 parent cef0580 commit 3cddbc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/app/core/services/date.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ export class DateService {
getUTCMidAfternoonDate(date: Date): Date {
const userTimezoneOffset = date.getTimezoneOffset() * 60000;
const newDate = new Date(date.getTime() + userTimezoneOffset + 12 * 60 * 60 * 1000);
newDate.setUTCDate(date.getDate());
newDate.setUTCMonth(date.getMonth());
newDate.setUTCFullYear(date.getFullYear());
newDate.setUTCMonth(date.getMonth());
newDate.setUTCDate(date.getDate());
return newDate;
}
}
4 changes: 2 additions & 2 deletions src/app/core/services/platform/v1/shared/date.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export class DateService {
getUTCMidAfternoonDate(date: Date): Date {
const userTimezoneOffset = date.getTimezoneOffset() * 60000;
const newDate = new Date(date.getTime() + userTimezoneOffset + 12 * 60 * 60 * 1000);
newDate.setUTCDate(date.getDate());
newDate.setUTCMonth(date.getMonth());
newDate.setUTCFullYear(date.getFullYear());
newDate.setUTCMonth(date.getMonth());
newDate.setUTCDate(date.getDate());
return newDate;
}

Expand Down

0 comments on commit 3cddbc1

Please sign in to comment.