Commit 958cd851 by yexing

[yx]update

parent 8163427c
3.2.5 3.4.4
\ No newline at end of file \ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> --> <!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> -->
</div> </div>
<div class="form-row"> <div class="form-row">
<label><input type="checkbox" value="GQL" name="option" checked /> 营销表</label> <label><input type="checkbox" value="GQL" name="option" /> 营销表</label>
<!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> --> <!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> -->
</div> </div>
<!-- <div class="form-row"> <!-- <div class="form-row">
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<input type="text" name="fromDate">-<input type="text" name="toDate"> <input type="text" name="fromDate">-<input type="text" name="toDate">
</div> --> </div> -->
<div class="form-row"> <div class="form-row">
<label><input type="checkbox" value="Advert" name="option" checked /> 广告表</label> <label><input type="checkbox" value="Advert" name="option" /> 广告表</label>
<!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> --> <!-- <input type="text" name="fromDate">-<input type="text" name="toDate"> -->
</div> </div>
<div class="form-row"> <div class="form-row">
......
import { TABLE } from "./conf.js"; import { TABLE } from "./conf.js";
import { Plan, addLog } from "./util.js"; import { Plan, addLog, getTimeDiff } from "./timezone.js";
import { getTimeDiff, getLocalTime } from "./timezone.js";
function showModal() { function showModal() {
document.querySelector('.modal').style.display = 'flex'; document.querySelector('.modal').style.display = 'flex';
...@@ -27,7 +26,7 @@ function onclick(e) { ...@@ -27,7 +26,7 @@ function onclick(e) {
// const period = [fromInput.value, toInput.value]; // const period = [fromInput.value, toInput.value];
// const period = ['2025-01-01', '2025-02-01']; // const period = ['2025-01-01', '2025-02-01'];
const period = new Plan(getLocalTime(), params).get()?.period; const period = new Plan(null, params).get();
if (period === undefined) { if (period === undefined) {
addLog(`${name} 未到指定时间`, true); addLog(`${name} 未到指定时间`, true);
return; return;
......
...@@ -87,15 +87,10 @@ export const addLog = (message, push) => chrome.runtime.sendMessage({ type: "add ...@@ -87,15 +87,10 @@ export const addLog = (message, push) => chrome.runtime.sendMessage({ type: "add
const checkTime = (time) => { const checkTime = (time) => {
if (!time.isValid()) throw new Error("无效时间"); if (!time.isValid()) throw new Error("无效时间");
} }
export function getLocalTime(dt) {
const time = dayjs.tz(dt ?? new Date(), CST);
checkTime(time);
return time.toDate();
}
export function getMouth(dt, offset = 0) { export function getMouth(dt, offset = 0) {
let time = dayjs.tz(dt ?? new Date(), CST).add(offset, "month"); let time = dayjs.tz(dt ?? new Date(), CST).add(offset, "month");
checkTime(time); checkTime(time);
return time.toDate(); return time.format("YYYY-MM");
} }
export function cutDate(period, date) { export function cutDate(period, date) {
const d1 = dayjs(period[0]); const d1 = dayjs(period[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment