diff --git a/com.twin.app.shoptime/package.json b/com.twin.app.shoptime/package.json index 56755ab8..bf172829 100644 --- a/com.twin.app.shoptime/package.json +++ b/com.twin.app.shoptime/package.json @@ -41,7 +41,6 @@ "@enact/webos": "^3.3.0", "axios": "^0.21.1", "ilib": "^14.3.0", - "moment": "^2.30.1", "prop-types": "^15.6.2", "qrcode": "^1.5.3", "raw-loader": "^4.0.2", diff --git a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerItemCard/PlayerItemCard.jsx b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerItemCard/PlayerItemCard.jsx index 25ca5509..929a5554 100644 --- a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerItemCard/PlayerItemCard.jsx +++ b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerItemCard/PlayerItemCard.jsx @@ -1,7 +1,6 @@ import React, { memo, useCallback, useEffect, useMemo, useState } from "react"; import classNames from "classnames"; -import moment from "moment"; import Spottable from "@enact/spotlight/Spottable"; @@ -82,23 +81,25 @@ export default memo(function PlayerItemCard({ }, [onFocus]); useEffect(() => { - const today = moment(); - const startDtMoment = moment(startDt); - const endDtMoment = moment(endDt); + const today = new Date(); + const startDtMoment = new Date(startDt); + const endDtMoment = new Date(endDt); - //라이브 영상 시간 (분) - const liveTime = endDtMoment.diff(startDtMoment, "minutes"); - //경과시간 (분) - const elapsedTime = today.diff(startDtMoment, "minutes"); + // 라이브 영상 시간 (분) + const liveTime = Math.floor((endDtMoment - startDtMoment) / (1000 * 60)); + // 경과시간 (분) + const elapsedTime = Math.floor((today - startDtMoment) / (1000 * 60)); const progressPercentage = (elapsedTime / liveTime) * 100; + console.log("#progressPercentage", progressPercentage); if (elapsedTime > 0) { setGaugeWidth(progressPercentage); } else { setGaugeWidth(0); } - }, [gaugeWidth]); + }, [startDt, endDt, gaugeWidth]); + const progressStyle = useMemo( () => ({ width: `${gaugeWidth}%` }), [gaugeWidth] diff --git a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx index 565c8f42..16dade62 100644 --- a/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx +++ b/com.twin.app.shoptime/src/views/PlayerPanel/PlayerPanel.jsx @@ -215,7 +215,7 @@ const PlayerPanel = ({ hideChildren, isTabActivated, ...props }) => {