Skip to content

Commit 1e7fcef

Browse files
authored
Update start.mjs
112
1 parent 3d2b08a commit 1e7fcef

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

scripts/start.mjs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,24 @@ try {
9898
}
9999
//
100100
idx = components.findIndex((item) => item.type === 2)
101+
// 获取今天的日期,但将时间和毫秒数重置为零
102+
const today = new Date();
103+
today.setHours(0, 0, 0, 0);
104+
105+
// 计算今天早上8:30的时间戳
106+
const startOfDay = new Date(today);
107+
startOfDay.setHours(8, 30, 0, 0);
108+
109+
// 计算今天下午6:00的时间戳
110+
const endOfDay = new Date(today);
111+
endOfDay.setHours(18, 0, 0, 0);
101112
const offWork = {
102113
type: 2,
103114
id: -2,
104115
workTitle: '距离下班还有',
105116
restTitle: '休息啦',
106-
startDate: new Date(2018, 3, 26, 9, 0, 0).getTime(),
107-
date: new Date(2018, 3, 26, 18, 0, 0).getTime(),
117+
startDate: startOfDay.getTime(),
118+
date: endOfDay.getTime() ,
108119
}
109120
if (idx >= 0) {
110121
components[idx] = {
@@ -145,9 +156,23 @@ try {
145156
dayColor: '#fff',
146157
date: '2025-01-29',
147158
}
159+
160+
const countdown2 = {
161+
type: 5,
162+
id: -5,
163+
topColor: 'linear-gradient(90deg, #FAD961 0%, #F76B1C 100%)',
164+
bgColor: 'rgb(235,129,124)',
165+
url: '',
166+
title: '距离休假过年还有',
167+
dateColor: '#fff',
168+
dayColor: '#fff',
169+
date: '2025-01-18',
170+
}
171+
148172
if (idx >= 0) {
149173
components[idx] = {
150174
...countdown,
175+
...countdown2,
151176
...components[idx],
152177
}
153178
components[idx].url = replaceJsdelivrCDN(components[idx].url, settings)

0 commit comments

Comments
 (0)