Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
simplified clock comp.
  • Loading branch information
DariusLukasukas committed Oct 29, 2023
1 parent ff481f4 commit 2b08985
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions components/ui/clock.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"use client"

import { useEffect, useMemo, useState } from "react"
import { twMerge } from "tailwind-merge"
import { useEffect, useState } from "react"

interface ClockProps {
initial: Date
timezone: number
className?: string
}

export default function Clock({ initial, timezone, className }: ClockProps) {
export default function Clock({ initial, timezone }: ClockProps) {
const [time, setTime] = useState(calculateLocalTime(initial, timezone))

useEffect(() => {
Expand All @@ -27,7 +25,7 @@ export default function Clock({ initial, timezone, className }: ClockProps) {
}

return (
<div className={twMerge("tabular.nums", className)}>
<div className="tabular.nums">
{time.toLocaleTimeString("en-US", {
timeZone: "UTC",
hour12: true,
Expand Down
1 change: 1 addition & 0 deletions lib/dateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function formatSunTimeWithAMPM(
): string {
const date = new Date((timestamp + timezoneOffset) * 1000)
const formattedTime = new Intl.DateTimeFormat("en-US", {
timeZone: "UTC",
hour: "numeric",
minute: "2-digit",
hour12: true,
Expand Down

0 comments on commit 2b08985

Please sign in to comment.