Skip to content

Commit

Permalink
fix: properly format local time displayed on user's profile (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithshariq authored Jun 22, 2023
1 parent e5342da commit 604cc62
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/utils/timezones.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { format } from "date-fns";

export const timezones = [
{
value: "Dateline Standard Time",
Expand Down Expand Up @@ -1198,5 +1200,6 @@ export const getTimeByTimezone = (offset: number) => {
// using supplied offset
const time = new Date(utc + 3600000 * offset);

return `${time.getHours()}:${time.getMinutes()}${time.getHours() > 11 ? "pm" : "am"}`;
// The formatted time in the specified timezone
return format(time, "hh:mmaaa");
};

0 comments on commit 604cc62

Please sign in to comment.