diff --git a/themes/heo/components/AnalyticsCard.js b/themes/heo/components/AnalyticsCard.js index 9732fcd4..a9d30477 100644 --- a/themes/heo/components/AnalyticsCard.js +++ b/themes/heo/components/AnalyticsCard.js @@ -1,23 +1,38 @@ +import CONFIG from '../config' + +/** + * 博客统计卡牌 + * @param {*} props + * @returns + */ export function AnalyticsCard(props) { + const targetDate = new Date(CONFIG.SITE_CREATE_TIME) + const today = new Date() + const diffTime = today.getTime() - targetDate.getTime() // 获取两个日期之间的毫秒数差值 + const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) // 将毫秒数差值转换为天数差值 + const { postCount } = props return <> -