1
0
silverbullet/packages/plugs/core/dates.ts
2022-04-25 10:33:38 +02:00

18 lines
434 B
TypeScript

import { insertAtCursor } from "@plugos/plugos-silverbullet-syscall/editor";
const dateMatchRegex = /(\d{4}\-\d{2}\-\d{2})/g;
export function niceDate(d: Date): string {
return d.toISOString().split("T")[0];
}
export async function insertToday() {
await insertAtCursor(niceDate(new Date()));
}
export async function insertTomorrow() {
let d = new Date();
d.setDate(d.getDate() + 1);
await insertAtCursor(niceDate(d));
}