diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 30cba66..c4d1fd4 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4577,7 +4577,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "todo" -version = "0.4.3" +version = "0.5.0" dependencies = [ "chrono", "dotenv", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 842ac60..0726c31 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "todo" -version = "0.4.3" +version = "0.5.0" description = "todo" authors = ["totono"] license = "" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 085e577..0965bda 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "todo", - "version": "0.4.3" + "version": "0.5.0" }, "tauri": { "systemTray": { diff --git a/src/components/elements/layouts/taskItem/Row.tsx b/src/components/elements/layouts/taskItem/Row.tsx index 7f22e47..e17688b 100644 --- a/src/components/elements/layouts/taskItem/Row.tsx +++ b/src/components/elements/layouts/taskItem/Row.tsx @@ -7,6 +7,7 @@ import { InputState } from "../../Input/InputState"; import { Content } from "./Content"; import { Header } from "./Header"; import { listItemStyle } from "./rowStyle"; +import dayjs from "dayjs"; const { Panel } = Collapse; @@ -40,11 +41,32 @@ export const Row = ({ task, setFetch }: rowProps) => { }))(task); const [taskState, setTaskState] = useState(state); + // check task is overdue + const activeId = () => { + if (taskState.limit_date === undefined + || taskState.is_completed === "Yes" + || taskState.is_deleted === "Yes") { + return undefined; + } + let time = taskState.limit_time; + if (time === undefined) { + time = "23:59"; + } + const today = dayjs(); + const limit = dayjs(taskState.limit_date + " " + time); + if (today.isAfter(limit)) { + return taskState.id; + } else { + undefined + }; + }; + + return (
  • - + { if (task.limit_date == undefined) {return "No"} - let time = "" - if (task.limit_time == undefined) { time = "23:59"} + let time = task.limit_time; + if (task.limit_time == undefined) { time = "23:59"}; const now = dayjs(); const limit = dayjs(task.limit_date +" "+ time); if (now.isBefore(limit)){