mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 11:10:41 +01:00
small script API additions
This commit is contained in:
@@ -254,6 +254,14 @@ function BackendScriptApi(currentNote, apiParams) {
|
||||
*/
|
||||
this.getDateNote = dateNoteService.getDateNote;
|
||||
|
||||
/**
|
||||
* Returns today's day note. If such note doesn't exist, it is created.
|
||||
*
|
||||
* @method
|
||||
* @returns {Promise<Note|null>}
|
||||
*/
|
||||
this.getTodayNote = dateNoteService.getTodayNote;
|
||||
|
||||
/**
|
||||
* Returns note for the first date of the week of the given date.
|
||||
*
|
||||
|
||||
@@ -170,6 +170,10 @@ async function getDateNote(dateStr) {
|
||||
return dateNote;
|
||||
}
|
||||
|
||||
async function getTodayNote() {
|
||||
return await getDateNote(dateUtils.localNowDate());
|
||||
}
|
||||
|
||||
function getStartOfTheWeek(date, startOfTheWeek) {
|
||||
const day = date.getDay();
|
||||
let diff;
|
||||
@@ -202,5 +206,6 @@ module.exports = {
|
||||
getYearNote,
|
||||
getMonthNote,
|
||||
getWeekNote,
|
||||
getDateNote
|
||||
getDateNote,
|
||||
getTodayNote
|
||||
};
|
||||
Reference in New Issue
Block a user