From 3282e95db0207ee133d1e98d9771dec9d83b0fc4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 02 四月 2026 16:24:38 +0800
Subject: [PATCH] 2026.4.2 新增专题管理功能

---
 miniprogram_npm/tdesign-miniprogram/common/shared/date.js |   42 +-----------------------------------------
 1 files changed, 1 insertions(+), 41 deletions(-)

diff --git a/miniprogram_npm/tdesign-miniprogram/common/shared/date.js b/miniprogram_npm/tdesign-miniprogram/common/shared/date.js
index 3ac46b3..ac43ef1 100644
--- a/miniprogram_npm/tdesign-miniprogram/common/shared/date.js
+++ b/miniprogram_npm/tdesign-miniprogram/common/shared/date.js
@@ -1,41 +1 @@
-export const getDateRect = (date) => {
-    const _date = new Date(date);
-    return {
-        year: _date.getFullYear(),
-        month: _date.getMonth(),
-        date: _date.getDate(),
-        day: _date.getDay(),
-        time: _date.getTime(),
-    };
-};
-export const isSameDate = (date1, date2) => {
-    if (date1 instanceof Date || typeof date1 === 'number')
-        date1 = getDateRect(date1);
-    if (date2 instanceof Date || typeof date2 === 'number')
-        date2 = getDateRect(date2);
-    const keys = ['year', 'month', 'date'];
-    return keys.every((key) => date1[key] === date2[key]);
-};
-export const getMonthDateRect = (date) => {
-    const { year, month } = getDateRect(date);
-    const firstDay = new Date(year, month, 1);
-    const weekdayOfFirstDay = firstDay.getDay();
-    const lastDate = new Date(+new Date(year, month + 1, 1) - 24 * 3600 * 1000).getDate();
-    return {
-        year,
-        month,
-        weekdayOfFirstDay,
-        lastDate,
-    };
-};
-export const isValidDate = (val) => typeof val === 'number' || val instanceof Date;
-export const getDate = (...args) => {
-    const now = new Date();
-    if (args.length === 0)
-        return now;
-    if (args.length === 1 && args[0] <= 1000) {
-        const { year, month, date } = getDateRect(now);
-        return new Date(year, month + args[0], date);
-    }
-    return Date.apply(null, args);
-};
+export const getDateRect=e=>{const t=new Date(e);return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),day:t.getDay(),time:t.getTime()}};export const isSameDate=(e,t)=>{(e instanceof Date||"number"==typeof e)&&(e=getDateRect(e)),(t instanceof Date||"number"==typeof t)&&(t=getDateRect(t));return["year","month","date"].every(a=>e[a]===t[a])};export const getMonthDateRect=e=>{const{year:t,month:a}=getDateRect(e);return{year:t,month:a,weekdayOfFirstDay:new Date(t,a,1).getDay(),lastDate:new Date(+new Date(t,a+1,1)-864e5).getDate()}};export const isValidDate=e=>"number"==typeof e||e instanceof Date;export const getDate=(...e)=>{const t=new Date;if(0===e.length)return t;if(1===e.length&&e[0]<=1e3){const{year:a,month:n,date:r}=getDateRect(t);return new Date(a,n+e[0],r)}return Date.apply(null,e)};
\ No newline at end of file

--
Gitblit v1.9.3