Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
ec06503
feat: 🎸 add first week of year option
JYC333 Mar 29, 2025
0ed957d
feat: 🎸 add week numbers
JYC333 Mar 30, 2025
6084352
feat: 🎸 reformat week number ui
JYC333 Mar 31, 2025
f8da749
feat: 🎸 create week number func
JYC333 Mar 31, 2025
dece88e
feat: 🎸 adjust calendar style
JYC333 Mar 31, 2025
71dc975
feat: 🎸 add prev month dates
JYC333 Mar 31, 2025
d79604d
feat: 🎸 add next month dates
JYC333 Mar 31, 2025
45633ad
fix: 🐛 fix error caused by first day of week change
JYC333 Mar 31, 2025
3b67364
fix: 🐛 fix prev/next month date not link to right note
JYC333 Mar 31, 2025
1581db5
refactor: 💡 remove unused code
JYC333 Mar 31, 2025
9c5a016
Merge branch 'develop' into calendar
JYC333 Mar 31, 2025
e701ada
chore: 🤖 improve calendar option page
JYC333 Mar 31, 2025
a80932d
chore: 🤖 add week number explanation
JYC333 Mar 31, 2025
ae7aaaf
fix: 🐛 fix calendar option error
JYC333 Mar 31, 2025
2dba6cb
chore: 🤖 using dayjs part 1
JYC333 Mar 31, 2025
f446fa3
fix: 🐛 fix calendar option error
JYC333 Mar 31, 2025
c1feedb
fix: 🐛 fix week number between years
JYC333 Mar 31, 2025
1a49c4a
chore: 🤖 use dayjs part 2
JYC333 Mar 31, 2025
be0b66c
chore: 🤖 use dayjs fully
JYC333 Mar 31, 2025
d7e809b
fix: 🐛 fix week number cross years
JYC333 Mar 31, 2025
6f30925
chore: 🤖 remove unused import
JYC333 Mar 31, 2025
ef8ecc4
chore: 🤖 fix minor
JYC333 Mar 31, 2025
674e597
refactor: 💡 rename getWeekNote to getWeekFirstDayNote
JYC333 Apr 1, 2025
bead99a
fix: 🐛 add missing builtin monthPattern label
JYC333 Apr 1, 2025
b13abf3
fix: 🐛 fix substring error
JYC333 Apr 1, 2025
c43cca6
feat: 🎸 add and fix week note api services
JYC333 Apr 1, 2025
22f1441
feat: 🎸 add enableWeekNote func
JYC333 Apr 1, 2025
84def1a
feat: 🎸 show exist week note when enable week note
JYC333 Apr 1, 2025
1313003
feat: 🎸 add create week note func
JYC333 Apr 1, 2025
1164126
feat: 🎸 add and update etapi
JYC333 Apr 1, 2025
3fe83e0
fix: 🐛 use first day of week option
JYC333 Apr 1, 2025
198842d
feat: 🎸 create day note under week note
JYC333 Apr 1, 2025
fc84729
feat: 🎸 clone week note when it cross month
JYC333 Apr 1, 2025
028ee38
chore: 🤖 move data_notes to using dayjs
JYC333 Apr 1, 2025
68d41f1
feat: 🎸 add quarter note support
JYC333 Apr 1, 2025
34aac54
feat: 🎸 allow more patterns for different journal level
JYC333 Apr 1, 2025
97dd624
refactor: 💡 improve code quality
JYC333 Apr 1, 2025
bbf7bc9
Merge branch 'develop' into calendar
JYC333 Apr 1, 2025
4866962
feat: 🎸 add backend script api
JYC333 Apr 1, 2025
50009bf
feat: 🎸 add frontend api support
JYC333 Apr 1, 2025
8bbe6ee
refactor: 💡 refact quarter func
JYC333 Apr 1, 2025
1630517
feat: 🎸 improve title parttern
JYC333 Apr 1, 2025
396c32b
Merge branch 'develop' into calendar
JYC333 Apr 2, 2025
dfd8631
feat: 🎸 add more date pattern
JYC333 Apr 2, 2025
c6a4e4c
chore: 🤖 use dayjs to get quarter number
JYC333 Apr 2, 2025
bf70b94
Merge branch 'develop' into calendar
JYC333 Apr 2, 2025
ddba049
chore: 🤖 Use dayjs to handle ordinal
JYC333 Apr 2, 2025
d7df050
feat: 🎸 add localization for week and quarter note name
JYC333 Apr 2, 2025
6ea3d5f
feat: 🎸 add yearPattern
JYC333 Apr 2, 2025
7cbdacc
feat: 🎸 improve journal name pattern
JYC333 Apr 2, 2025
ad3e7d6
docs: ✏️ update journal docs
JYC333 Apr 2, 2025
0e3e823
test: 💍 add journal unit test
JYC333 Apr 2, 2025
dc16b2c
Merge branch 'develop' into calendar
JYC333 Apr 3, 2025
79a7513
fix: 🐛 fix ordinal locale
JYC333 Apr 3, 2025
eb514ad
chore: 🤖 improve code
JYC333 Apr 3, 2025
6a0207d
fix: 🐛 fix async errors
JYC333 Apr 4, 2025
f9c0b88
refactor: 💡 fix lint
JYC333 Apr 4, 2025
7bb1e60
refactor: 💡 fix date_notes format
JYC333 Apr 4, 2025
36bf342
Merge branch 'develop' into calendar
eliandoran Apr 6, 2025
b41025e
chore(deps): update package-lock
eliandoran Apr 6, 2025
b593559
chore(docs): sync
eliandoran Apr 6, 2025
6a94889
feat(docs): reorganize script notes & document render note
eliandoran Apr 6, 2025
4126a8c
feat(docs): reorganize & merge attachments
eliandoran Apr 6, 2025
cc391eb
chore(docs): sync
eliandoran Apr 6, 2025
15f62ba
feat(docs): update day notes documentation
eliandoran Apr 6, 2025
aca27d1
Merge remote-tracking branch 'origin/develop' into calendar
eliandoran Apr 6, 2025
a4f5903
chore(docs): revert changes to meta
eliandoran Apr 6, 2025
f346c40
fix: 🐛 fix crash when no calendarRoot
JYC333 Apr 8, 2025
32a6aed
Merge remote-tracking branch 'origin/develop' into calendar
eliandoran Apr 10, 2025
6322f84
fix: 🐛 fix clipper build error
JYC333 Apr 10, 2025
7f381cb
fix: 🐛 fix sender.ts build error
JYC333 Apr 10, 2025
a554085
fix: 🐛 fix tray.ts build error
JYC333 Apr 10, 2025
998abb3
fix: 🐛 fix calendar unit test error
JYC333 Apr 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bin/tpl/anonymize-database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ UPDATE attributes SET name = 'name', value = 'value' WHERE type = 'label'
'widget', 'noteInfoWidgetDisabled', 'linkMapWidgetDisabled', 'revisionsWidgetDisabled',
'whatLinksHereWidgetDisabled', 'similarNotesWidgetDisabled', 'workspace', 'workspaceIconClass',
'workspaceTabBackgroundColor', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox',
'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId',
'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'weekPattern', 'enableWeekNote', 'monthPattern',
'quarterPattern', 'yearPattern', 'enableQuarterNote', 'pageSize', 'viewType', 'mapRootNoteId',
'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top',
'fullContentWidth', 'shareHiddenFromTree', 'shareExternalLink', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription',
'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate',
Expand All @@ -31,7 +32,8 @@ UPDATE attributes SET name = 'name' WHERE type = 'relation'
'widget', 'noteInfoWidgetDisabled', 'linkMapWidgetDisabled', 'revisionsWidgetDisabled',
'whatLinksHereWidgetDisabled', 'similarNotesWidgetDisabled', 'workspace', 'workspaceIconClass',
'workspaceTabBackgroundColor', 'workspaceCalendarRoot', 'workspaceTemplate', 'searchHome', 'workspaceInbox',
'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'pageSize', 'viewType', 'mapRootNoteId',
'workspaceSearchHome', 'sqlConsoleHome', 'datePattern', 'weekPattern', 'enableWeekNote', 'monthPattern',
'quarterPattern', 'yearPattern', 'enableQuarterNote', 'pageSize', 'viewType', 'mapRootNoteId',
'bookmarkFolder', 'sorted', 'sortDirection', 'sortFoldersFirst', 'sortNatural', 'sortLocale', 'top',
'fullContentWidth', 'shareHiddenFromTree', 'shareExternalLink', 'shareOmitDefaultCss', 'shareRoot', 'shareDescription',
'shareRaw', 'shareDisallowRobotIndexing', 'shareIndex', 'displayRelations', 'hideRelations', 'titleTemplate',
Expand Down
62 changes: 31 additions & 31 deletions docs/User Guide/!!!meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"formatVersion": 2,
"appVersion": "0.92.6",
"appVersion": "0.92.7",
"files": [
{
"isClone": false,
Expand Down Expand Up @@ -3511,58 +3511,51 @@
"position": 20
},
{
"type": "label",
"name": "shareAlias",
"value": "search",
"isInheritable": false,
"position": 20
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-search-alt-2",
"type": "relation",
"name": "internalLink",
"value": "OR8WJ7Iz9K4U",
"isInheritable": false,
"position": 30
},
{
"type": "relation",
"name": "internalLink",
"value": "xYmIYSP6wE3F",
"value": "wX4HbRucYSDD",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "YtSN43OrfzaA",
"value": "ivYnonVFBxbQ",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "OR8WJ7Iz9K4U",
"value": "xYmIYSP6wE3F",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "9sRHySam5fXb",
"value": "YtSN43OrfzaA",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "m523cpzocqaD",
"value": "9sRHySam5fXb",
"isInheritable": false,
"position": 80
},
{
"type": "relation",
"name": "internalLink",
"value": "wX4HbRucYSDD",
"value": "m523cpzocqaD",
"isInheritable": false,
"position": 90
},
Expand Down Expand Up @@ -3590,16 +3583,23 @@
{
"type": "relation",
"name": "internalLink",
"value": "ivYnonVFBxbQ",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 130
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"type": "label",
"name": "shareAlias",
"value": "search",
"isInheritable": false,
"position": 140
"position": 20
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-search-alt-2",
"isInheritable": false,
"position": 30
}
],
"format": "markdown",
Expand Down Expand Up @@ -3852,16 +3852,16 @@
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "iconClass",
"value": "bx bx-search-alt-2",
"type": "relation",
"name": "internalLink",
"value": "MI26XDLSAlCD",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "8YBEPzcpUgxw",
"value": "iPIMuisry3hd",
"isInheritable": false,
"position": 20
},
Expand All @@ -3875,16 +3875,16 @@
{
"type": "relation",
"name": "internalLink",
"value": "iPIMuisry3hd",
"value": "8YBEPzcpUgxw",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "MI26XDLSAlCD",
"type": "label",
"name": "iconClass",
"value": "bx bx-search-alt-2",
"isInheritable": false,
"position": 50
"position": 10
}
],
"format": "markdown",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,91 @@ This pattern works well also because of [Cloning Notes](../../Basic%20Concepts%2

![](Day%20Notes_image.png)

You can see the structure of day notes appearing under "Journal" note - there's a note for the whole year 2017, under it, you have "12 - December" which then contains "18 - Monday". This is our "day note" which contains some text in its content and also has some child notes (some of them are from [Task manager](Task%20Manager.md)).
You can see the structure of day notes appearing under "Journal" note - there's a note for the whole year 2025, under it, you have "03 - March" which then contains "09 - Monday". This is our "day note" which contains some text in its content and also has some child notes (some of them are from [Task manager](Task%20Manager.md)).

You can also notice how this day note has [promoted attribute](../Attributes/Promoted%20Attributes.md) "weight" where you can track your daily weight. This data is then used in [Weight tracker](Weight%20Tracker.md).

## Week Note and Quarter Note

Week and quarter notes are disabled by default, since it might be too much for some people. To enable them, you need to set `#enableWeekNotes` and `#enableQuarterNotes` attributes on the root calendar note, which is identified by `#calendarRoot` label. Week note is affected by the first week of year option. Be careful when you already have some week notes created, it will not automatically change the existing week notes and might lead to some duplicates.

## Templates

Trilium provides [template](../Templates.md) functionality, and it could be used together with day notes.

You can define one of the following relations on the root of the journal (identified by `#calendarRoot` label):

* yearTemplate
* quarterTemplate (if `#enableQuarterNotes` is set)
* monthTemplate
* weekTemplate (if `#enableWeekNotes` is set)
* dateTemplate

All of these are relations. When Trilium creates a new note for year or month or date, it will take a look at the root and attach a corresponding `~template` relation to the newly created role. Using this, you can e.g. create your daily template with e.g. checkboxes for daily routine etc.

## Date pattern
## Naming pattern

You can customize the title of generated journal notes by defining a `#datePattern`, `#weekPattern`, `#monthPattern`, `#quarterPattern` and `#yearPattern` attribute on a root calendar note (identified by `#calendarRoot` label). The naming pattern replacements follow a level-up compatibility - each level can use replacements from itself and all levels above it. For example, `#monthPattern` can use month, quarter and year replacements, while `#weekPattern` can use week, month, quarter and year replacements. But it is not possible to use week replacements in `#monthPattern`.

It's possible to customize the title of generated date notes by defining a `#datePattern` label on a root calendar note (identified by `#calendarRoot` label). Following are possible values:
### Date pattern

* `{dayInMonthPadded} - {weekDay}` day notes are named e.g. "24 - Monday"
* `{dayInMonthPadded}: {weekDay3}` day notes are named e.g. "24: Mon"
* `{dayInMonthPadded}: {weekDay2}` day notes are named e.g. "24: Mo"
* `{isoDate} - {weekDay}` day notes are named e.g. "2020-12-24 - Monday"
It's possible to customize the title of generated date notes by defining a `#datePattern` attribute on a root calendar note (identified by `#calendarRoot` label). Following are possible values:

* `{isoDate}` results in an ISO 8061 formatted date (e.g. "2025-03-09" for March 9, 2025)
* `{dateNumber}` results in a number like `9` for the 9th day of the month, `11` for the 11th day of the month
* `{dateNumberPadded}` results in a number like `09` for the 9th day of the month, `11` for the 11th day of the month
* `{ordinal}` is replaced with the ordinal date (e.g. 1st, 2nd, 3rd) etc.
* `{weekDay}` results in the full day name (e.g. `Monday`)
* `{weekDay3}` is replaced with the first 3 letters of the day, e.g. Mon, Tue, etc.
* `{weekDay2}` is replaced with the first 2 letters of the day, e.g. Mo, Tu, etc.

The default is `{dateNumberPadded} - {weekDay}`

### Week pattern

It is also possible to customize the title of generated week notes through the `#weekPattern` attribute on the root calendar note. The options are:

* `{weekNumber}` results in a number like `9` for the 9th week of the year, `11` for the 11th week of the year
* `{weekNumberPadded}` results in a number like `09` for the 9th week of the year, `11` for the 11th week of the year
* `{shortWeek}` results in a short week string like `W9` for the 9th week of the year, `W11` for the 11th week of the year
* `{shortWeek3}` results in a short week string like `W09` for the 9th week of the year, `W11` for the 11th week of the year

The default is `Week {weekNumber}`

## Month pattern
### Month pattern

It is also possible to customize the title of generated month notes through the `#monthPattern` attribute, much like `#datePattern`. The options are:
It is also possible to customize the title of generated month notes through the `#monthPattern` attribute on the root calendar note. The options are:

* `{isoMonth}` results in an ISO 8061 formatted month (e.g. "2025-03" for March 2025)
* `{monthNumber}` results in a number like `9` for September, and `11` for November
* `{monthNumberPadded}` results in a number like `09` for September, and `11` for November
* `{month}` results in the full month name (e.g. `September` or `October`)
* `{shortMonth3}` is replaced with the first 3 letters of the month, e.g. Jan, Feb, etc.
* `{shortMonth4}` is replaced with the first 4 letters of the month, e.g. Sept, Octo, etc.

The default is `{monthNumberPadded} - {month}`

### Quarter pattern

It is also possible to customize the title of generated quarter notes through the `#quarterPattern` attribute on the root calendar note. The options are:

* `{quarterNumber}` results in a number like `1` for the 1st quarter of the year
* `{shortQuarter}` results in a short quarter string like `Q1` for the 1st quarter of the year

The default is `Quarter {quarterNumber}`

### Year pattern

It is also possible to customize the title of generated year notes through the `#yearPattern` attribute on the root calendar note. The options are:

* `{year}` results in the full year (e.g. `2025`)

The default is `{year}`

## Implementation

Trilium has some special support for day notes in the form of [backend Script API](https://triliumnext.github.io/Notes/backend_api/BackendScriptApi.html) - see e.g. getDayNote() function.

Day (and year, month) notes are created with a label - e.g. `#dateNote="2018-08-16"` this can then be used by other scripts to add new notes to day note etc.
Day (and year, month) notes are created with a label - e.g. `#dateNote="2025-03-09"` this can then be used by other scripts to add new notes to day note etc.

Journal also has relation `child:child:child:template=Day template` (see \[\[attribute inheritance\]\]) which effectively adds \[\[template\]\] to day notes (grand-grand-grand children of Journal).
Journal also has relation `child:child:child:template=Day template` (see \[\[attribute inheritance\]\]) which effectively adds \[\[template\]\] to day notes (grand-grand-grand children of Journal). Please note that, when you enable week notes or quarter notes, it will not automatically change the relation for the child level.
2 changes: 1 addition & 1 deletion docs/frontend_api/FrontendScriptApi.html
Original file line number Diff line number Diff line change
Expand Up @@ -4680,7 +4680,7 @@ <h5>Returns:</h5>



<h4 class="name" id="getWeekNote"><span class="type-signature"></span>getWeekNote<span class="signature">(date)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="FNote.html">FNote</a>>}</span></h4>
<h4 class="name" id="getWeekFirstDayNote"><span class="type-signature"></span>getWeekFirstDayNote<span class="signature">(date)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="FNote.html">FNote</a>>}</span></h4>



Expand Down
2 changes: 1 addition & 1 deletion docs/frontend_api/services_frontend_script_api.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ <h1 class="page-title">Source: services/frontend_script_api.js</h1>
* @param {string} date - e.g. "2019-04-29"
* @returns {Promise&lt;FNote>}
*/
this.getWeekNote = dateNotesService.getWeekNote;
this.getWeekFirstDayNote = dateNotesService.getWeekFirstDayNote;

/**
* Returns month-note. If it doesn't exist, it is automatically created.
Expand Down
2 changes: 1 addition & 1 deletion src/etapi/etapi.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ paths:
/calendar/weeks/{date}:
get:
description: returns a week note for a given date. Gets created if doesn't exist.
operationId: getWeekNote
operationId: getWeekFirstDayNote
parameters:
- name: date
in: path
Expand Down
Loading
Loading