Skip to content

Commit

Permalink
correct for timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Oct 12, 2023
1 parent 8a67ea5 commit e38206a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ export const formatDateTime = (date: DateLike, format?: string) => {
return obj.format(format);
}

// formatDate if hours, minutes and seconds are 0
if (obj.hour() === 0 && obj.minute() === 0 && obj.second() === 0) {
// formatDate if hours, minutes and seconds are 0 (after timezone correction)
const utc = obj.subtract(obj.utcOffset(), "minute");
if (utc.hour() === 0 && utc.minute() === 0 && utc.second() === 0) {
return obj.format(DATE_FORMAT);
}

Expand Down

0 comments on commit e38206a

Please sign in to comment.