trilium/src/public/javascripts/services/date_notes.js

35 lines
928 B
JavaScript
Raw Normal View History

import treeCache from "./tree_cache.js";
import server from "./server.js";
/** @return {NoteShort} */
async function getTodayNote() {
return await getDateNote(dayjs().format("YYYY-MM-DD"));
}
/** @return {NoteShort} */
async function getDateNote(date) {
2019-10-28 05:13:38 +08:00
const note = await server.get('date-notes/date/' + date, {'trilium-source-id': "date-note"});
return await treeCache.getNote(note.noteId);
}
/** @return {NoteShort} */
async function getMonthNote(month) {
2019-10-28 05:13:38 +08:00
const note = await server.get('date-notes/month/' + month, {'trilium-source-id': "date-note"});
return await treeCache.getNote(note.noteId);
}
/** @return {NoteShort} */
async function getYearNote(year) {
2019-10-28 05:13:38 +08:00
const note = await server.get('date-notes/year/' + year, {'trilium-source-id': "date-note"});
return await treeCache.getNote(note.noteId);
}
export default {
getTodayNote,
getDateNote,
getMonthNote,
getYearNote
}