Eg, this is the completion date for completed tasks, etc.
+.statedate {
+ margin-right: 0.5em;
+}
#ui {
padding: 15px 10px;
}
#ui {
padding: 15px 10px;
}
setState: function (stateTimestamp: string, createTimestamp: string, state: string) {
const task = this.getTask(createTimestamp);
setState: function (stateTimestamp: string, createTimestamp: string, state: string) {
const task = this.getTask(createTimestamp);
- if (task) {
- task.setAttribute("data-state", state);
+ if (!task) return;
+ task.setAttribute("data-state", state);
+ var date = task.getElementsByClassName("statedate")[0];
+ if (state === "todo") {
+ task.removeChild(date);
+ return;
+ if (!date) {
+ date = document.createElement("span");
+ date.classList.add("statedate");
+ task.insertBefore(date, task.firstChild);
+ }
+ const d = new Date(parseInt(stateTimestamp));
+ date.textContent = `${d.getFullYear()}-${`${d.getMonth() + 1}`.padStart(2, "0")}-${`${d.getDate()}`.padStart(2, "0")}`;