title | aliases | created | updated | |
---|---|---|---|---|
Inbox |
|
2023-11-22 14:01:18 +0600 |
2023-11-23 08:49:57 +0600 |
// I am using Custom JS plugin to define common JS functions throughout the vault.
const {Formatters} = customJS;
const now = dv.luxon.DateTime.now()
const in_three_days = now.plus({days: 3});
let letters = dv.pages('"Personal/Letters to Self"').where((l) => {
if (l.from != "Younger") return false;
const delivery_date = dv.date(l.deliver_on);
return (delivery_date > now && delivery_date <= in_three_days && !dv.pages('"Personal/Letters to Self"').where((p) => p.from == "Older" && p.replied_to.path == l.file.path).length);
}).sort(l => l.deliver_on, 'desc');
if (!letters.length) {
dv.paragraph("No letter to be expected soon!")
} else {
letters.forEach((l) => {
Formatters.format_letter(l, dv);
});
}
const {Formatters} = customJS;
const now = dv.luxon.DateTime.now();
let letters = dv.pages('"Personal/Letters to Self"').where((l) => {
return l.from == "Younger" && (dv.date(l.deliver_on) <= now && !dv.pages('"Personal/Letters to Self"').where((p) => p.from == "Older" && p.replied_to.path == l.file.path).length);
}).sort(l => l.deliver_on, 'desc');
if (!letters.length) {
dv.paragraph("No letter to reply!")
} else {
letters.forEach((l) => {
Formatters.format_letter(l, dv, true);
});
}
const {Formatters} = customJS;
const now = dv.luxon.DateTime.now();
let letters = dv.pages('"Personal/Letters to Self"').where((l) => {
if (!l.from) return false;
if (l.from == "Older") return true;
return (dv.date(l.deliver_on) <= now && dv.pages('"Personal/Letters to Self"').where((p) => p.from == "Older" && p.replied_to.path == l.file.path).length)
}).sort(l => l.from == "Older" ? l.created : l.deliver_on, 'desc');
if (!letters.length) {
dv.paragraph("No letter in the Archive!");
} else {
letters.forEach((l) => {
console.log(l);
Formatters.format_letter(l, dv, true);
})
}