Ensure dates consider timezones
parent
5abcc8bc85
commit
b91a55cb64
|
@ -1,3 +1,11 @@
|
||||||
export function niceDate(d: Date): string {
|
export function niceDate(d: Date): string {
|
||||||
return d.toISOString().split("T")[0];
|
function pad(n: number) {
|
||||||
|
let s = String(n);
|
||||||
|
if (s.length === 1) {
|
||||||
|
s = '0' + s;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate())
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,8 +143,7 @@ export async function dailyNoteCommand() {
|
||||||
} catch {
|
} catch {
|
||||||
console.warn(`No daily note template found at ${dailyNoteTemplate}`);
|
console.warn(`No daily note template found at ${dailyNoteTemplate}`);
|
||||||
}
|
}
|
||||||
let isoDate = new Date().toISOString();
|
let date = niceDate(new Date())
|
||||||
let date = isoDate.split("T")[0];
|
|
||||||
let pageName = `${dailyNotePrefix}${date}`;
|
let pageName = `${dailyNotePrefix}${date}`;
|
||||||
if (dailyNoteTemplateText) {
|
if (dailyNoteTemplateText) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue