Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion journal-entry/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"identifier": "journal-entry",
"script": "journal-entry.qml",
"resources": ["calendar-window.qml"],
"version": "1.7.0",
"version": "1.8.0",
"minAppVersion": "20.4.16",
"authors": ["@pbek", "@sanderboom", "@kantrol", "@nico2sh"],
"description": "This script creates menu items and buttons to create or jump to the current date's (or tomorrow's date) journal entry. And formats the title based on a date placeholder. It also allows to open a calendar to choose the date."
Expand Down
6 changes: 5 additions & 1 deletion journal-entry/journal-entry.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import com.qownnotes.noteapi 1.0
*/
QtObject {
id: journalEntry
readonly property variant _SHORT_DAYS_EN: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]


property string defaultFolder
property string defaultTags
Expand All @@ -31,7 +33,7 @@ QtObject {
{
"identifier": "noteTitleFormat",
"name": "Title Format",
"description": "How the journal title should be formatted, use date format placeholders inside curly braces. YYYY: year, MM: month, DD: day, WW: week, HH: hours, mm: minutes, ss: seconds. For example \"Journal {YYYYMMDD}\" will return \"Journal 20240928\". You can have monthly or weekly journals instead of daily by formatting the date to the week or monthly level, or one journal file per entry by including the hour, minutes and seconds.",
"description": "How the journal title should be formatted, use date format placeholders inside curly braces. YYYY: year, MM: month, DD: day, WW: week, HH: hours, mm: minutes, ss: seconds, ddd: short day of the week e.g. 'Mon'. For example \"Journal {YYYYMMDD}\" will return \"Journal 20240928\". You can have monthly or weekly journals instead of daily by formatting the date to the week or monthly level, or one journal file per entry by including the hour, minutes and seconds.",
"type": "string",
"default": "Journal {YYYYMMDD}"
},
Expand Down Expand Up @@ -137,6 +139,7 @@ QtObject {
}
function formatDate(date, format) {
let day = date.getDate();
let dayOfWeek = _SHORT_DAYS_EN[date.getDay()];
let month = date.getMonth() + 1; //getMonth() returns 0-11 so we must add 1
let week = getWeekNumber(date);
let year = date.getFullYear();
Expand All @@ -156,6 +159,7 @@ QtObject {
format = format.replace('WW', week);
format = format.replace('MM', month);
format = format.replace('DD', day);
format = format.replace('ddd', dayOfWeek);
format = format.replace('YYYY', year);
format = format.replace('HH', hours);
format = format.replace('mm', minutes);
Expand Down
2 changes: 1 addition & 1 deletion quick-commands/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"script": "quick-commands.qml",
"authors": ["@LockeBirdsey"],
"platforms": ["linux", "macos", "windows"],
"version": "0.0.1",
"version": "0.1.0",
"minAppVersion": "25.4.1",
"description": "Short commands to help with repetive and/or annoying things to write frequently such as timestamps.\n\nEach command starts with a backslash (\\) and a single word for the command. Select the autocomplete option you desire and the command text will be replace.\n\nDefault commands are: today, tomorrow, yesterday, now, week.\n\nCustom commands can also be specified but are limited to simple text replacement."
}
8 changes: 7 additions & 1 deletion quick-commands/quick-commands.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ Script {
readonly property int _MILLI_DAY: 86400000
readonly property string _WEEKWWYYYY: "wWW-YYYY"
readonly property string _WWYYYY: "WW-YYYY"
// DateFormats
readonly property string _YYYYMMDD: "YYYY-MM-DD"
readonly property string _DDDDMY: "ddd (DD-MM-YYYY)"
readonly property variant _SHORT_DAYS_EN: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]

property var commands
property string customCommands

property variant settingsVariables: [
{
"identifier": "customCommands",
Expand Down Expand Up @@ -52,13 +55,15 @@ Script {
timeList.push(formatDate(date, _DDMM));
timeList.push(formatDate(date, _YYYYMMDD));
timeList.push(formatDate(date, _DDMMYYYY));
timeList.push(formatDate(date, _DDDDMY));
timeList.push(formatDate(date, _FULL));
return timeList;
}

// Taken from https://github.com/qownnotes/scripts/blob/master/journal-entry/journal-entry.qml
function formatDate(date, format) {
let day = date.getDate();
let dayOfWeek = _SHORT_DAYS_EN[date.getDay()];
let month = date.getMonth() + 1; //getMonth() returns 0-11 so we must add 1
let week = getWeekNumber(date);
let year = date.getFullYear();
Expand All @@ -78,6 +83,7 @@ Script {
format = format.replace('WW', week);
format = format.replace('MM', month);
format = format.replace('DD', day);
format = format.replace('ddd', dayOfWeek);
format = format.replace('YYYY', year);
format = format.replace('HH', hours);
format = format.replace('mm', minutes);
Expand Down