Skip to content

Commit

Permalink
Merge pull request #79 from jarrisondev/main
Browse files Browse the repository at this point in the history
change startTime relative to the timezone
  • Loading branch information
afordigital authored Sep 19, 2024
2 parents 27d8b16 + d3b6f78 commit 0ca1d55
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/components/common/Countdown.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { useEffect, useLayoutEffect, useState } from "react";
import { cn } from "../utils";
import { useTime } from "@/hooks/useTimezone";

interface CountDownProps {
className?: string;
startFrom?: Date;
}

export const Countdown = ({ className, startFrom }: CountDownProps) => {
export const Countdown = ({ className }: CountDownProps) => {
const time = [
{ key: "days", label: "Días" },
{ key: "hours", label: "Horas" },
{ key: "minutes", label: "Minutos" },
{ key: "seconds", label: "Segundos" },
];

const startTime = useTime({ timestamp: 1726855200000});
const [timeLeft, setTimeLeft] = useState({
days: 0,
hours: 0,
Expand All @@ -23,7 +24,7 @@ export const Countdown = ({ className, startFrom }: CountDownProps) => {

const updateCountdown = () => {
// Establecer la fecha y hora de finalización (20 Septiembre 2024, 20:00 en UTC+2)
const countdownDate = startFrom || new Date("2024-09-20T18:00:00Z"); // UTC+2 es dos horas menos que UTC
const countdownDate = new Date("2024-09-20T18:00:00Z"); // UTC+2 es dos horas menos que UTC

const now = new Date();

Expand Down Expand Up @@ -65,7 +66,7 @@ export const Countdown = ({ className, startFrom }: CountDownProps) => {
</section>
))}
</div>
<p className="font-semibold">20 de Septiembre de 2024 a las 20:00</p>
<p className="font-semibold">20 de Septiembre de 2024 a las {startTime}</p>
</div>
);
};

0 comments on commit 0ca1d55

Please sign in to comment.