mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-22 12:45:50 +00:00
Update Navbar component to use moment-timezone for countdown timer calculations
This commit is contained in:
@@ -6,7 +6,7 @@ import { Link } from "@redocly/theme/components/Link/Link";
|
|||||||
import { ColorModeSwitcher } from "@redocly/theme/components/ColorModeSwitcher/ColorModeSwitcher";
|
import { ColorModeSwitcher } from "@redocly/theme/components/ColorModeSwitcher/ColorModeSwitcher";
|
||||||
import { Search } from "@redocly/theme/components/Search/Search";
|
import { Search } from "@redocly/theme/components/Search/Search";
|
||||||
import arrowUpRight from "../../../static/img/icons/arrow-up-right-custom.svg";
|
import arrowUpRight from "../../../static/img/icons/arrow-up-right-custom.svg";
|
||||||
import moment from "moment";
|
import moment from "moment-timezone";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
||||||
@@ -23,11 +23,9 @@ function useCountdown(targetDate: string) {
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const calculateTimeLeft = () => {
|
const calculateTimeLeft = () => {
|
||||||
// Target: June 11, 2025 at 8AM Singapore time (GMT+8)
|
// Create target date in Singapore timezone (Asia/Singapore)
|
||||||
// Singapore is UTC+8, so 8AM Singapore = 0AM UTC (midnight UTC)
|
const target = moment.tz(targetDate, "YYYY-MM-DD HH:mm:ss", "Asia/Singapore");
|
||||||
const targetSingaporeTime = moment(targetDate, "YYYY-MM-DD HH:mm:ss");
|
const now = moment();
|
||||||
const target = targetSingaporeTime.clone().subtract(8, 'hours').utc();
|
|
||||||
const now = moment().utc();
|
|
||||||
const diff = target.diff(now);
|
const diff = target.diff(now);
|
||||||
|
|
||||||
if (diff <= 0) {
|
if (diff <= 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user