feat: add vitest, vite, move to tdd
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import matter from "gray-matter";
|
||||
import { Task } from "../model/task";
|
||||
import { Task } from "@/model/task";
|
||||
|
||||
function toISO(value: unknown): string {
|
||||
if (value instanceof Date) return value.toISOString();
|
||||
if (typeof value === "string") return value;
|
||||
return new Date().toISOString();
|
||||
}
|
||||
|
||||
export function parseTaskFile(content: string): Task {
|
||||
const parsed = matter(content);
|
||||
@@ -11,8 +17,8 @@ export function parseTaskFile(content: string): Task {
|
||||
priority: parsed.data.priority ?? "medium",
|
||||
tags: parsed.data.tags ?? [],
|
||||
assignee: parsed.data.assignee ?? "",
|
||||
created: parsed.data.created ?? new Date().toISOString(),
|
||||
updated: parsed.data.updated ?? new Date().toISOString(),
|
||||
created: toISO(parsed.data.created),
|
||||
updated: toISO(parsed.data.updated),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user