diff --git a/package.json b/package.json index 61f6888..e327618 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "joplin-plugin-journal", - "version": "1.1.1", + "version": "1.1.2", "scripts": { "dist": "export NODE_OPTIONS=--openssl-legacy-provider && webpack --joplin-plugin-config buildMain && webpack --joplin-plugin-config buildExtraScripts && webpack --joplin-plugin-config createArchive", "prepare": "export NODE_OPTIONS=--openssl-legacy-provider && npm run dist", diff --git a/src/index.ts b/src/index.ts index b014cef..81d34c0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -67,7 +67,20 @@ async function makeNoteName(d) { } console.log(`Jouranl tmpl: ${noteTmpl}, monthStyle:${monthStyle}, dayStyle:${dayStyle}, weekdayStyle:${weekdayStyle}`); - let data = { year: '', month: '', monthName: '', day: '', hour: '', min: '', sec: '', weekday: '', weekdayName: '', weekNum:'' }; + let data = { + year: '', + month: '', + monthName: '', + day: '', + hour: '', + min: '', + sec: '', + weekday: '', + weekdayName: '', + weekNum:'', + ampm:'', + hour12:'', + }; data.year = '' + year; // convert number to string switch (monthStyle) { case 'pad_num': @@ -123,7 +136,9 @@ async function makeNoteName(d) { data.hour = padding(hour); data.min = padding(min); data.sec = padding(sec); - + data.ampm = hour >= 12 ? "PM" : "AM"; + const hour12 = hour % 12 + data.hour12 = padding(hour12 ? hour12 : 12) console.log(`Journal tmpl data: `, data); const noteName = tplEngin(noteTmpl, data); @@ -227,7 +242,7 @@ joplin.plugins.register({ section: 'Journal', public: true, label: 'Note Name Template', - description: `There are several variables: {{year}}, {{month}}, {{monthName}}, {{day}}, {{hour}}, {{min}}, {{weekday}}, {{weekdayName}}, {{weekNum}}, which will expand into the actual value when opening or creating notes. The '/' character will create a hierarchical folder. The default vaule is: '${defaultNoteName}'.` + description: `There are several variables: {{year}}, {{month}}, {{monthName}}, {{day}}, {{hour}}, {{hour12}}, {{ampm}}, {{min}}, {{weekday}}, {{weekdayName}}, {{weekNum}}, which will expand into the actual value when opening or creating notes. The '/' character will create a hierarchical folder. The default vaule is: '${defaultNoteName}'.` }, 'MonthStyle': { diff --git a/src/manifest.json b/src/manifest.json index cd884ae..fe4c9c5 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 1, "id": "com.leenzhu.journal", "app_min_version": "2.7", - "version": "1.1.1", + "version": "1.1.2", "name": "Journal", "description": "A simple journal. Create or open a note for today, or any selected date.", "author": "Leen Zhu",