|
|
@@ -168,4 +168,33 @@ export function getFullTimer() {
|
|
|
const day = now.getDate();
|
|
|
// 格式:2026-01-29
|
|
|
return `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+export function useSelectDateForUpdate(code) {
|
|
|
+ function getDate() {
|
|
|
+ return cacheManager.get(code);
|
|
|
+ }
|
|
|
+
|
|
|
+ function updateDate() {
|
|
|
+ console.log(1111)
|
|
|
+ cacheManager.set(code, getFullTimer())
|
|
|
+ }
|
|
|
+
|
|
|
+ function isNowDate() {
|
|
|
+ const nowDate = getDate();
|
|
|
+ if (!nowDate) {
|
|
|
+ updateDate();
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (nowDate != getFullTimer()) {
|
|
|
+ updateDate();
|
|
|
+ }
|
|
|
+
|
|
|
+ return nowDate == getFullTimer();
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ isNowDate
|
|
|
+ }
|
|
|
}
|