From 922181ee93acee7baabfb760275b7c0f84e43034 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 29 Jun 2024 18:21:31 +0300 Subject: [PATCH] Add Cmd+' shortcut for local time and change the format of time --- static/shortcuts.js | 1 + static/toolbar.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/static/shortcuts.js b/static/shortcuts.js index b36dd19..9dcd577 100644 --- a/static/shortcuts.js +++ b/static/shortcuts.js @@ -330,6 +330,7 @@ if (document.body.dataset.rrhAddr.startsWith('/edit')) { new Shortcut(isMac ? 'Meta+k' : 'Ctrl+k', wrapLink, 'Inline link', { force: true }), // Apparently, ⌘; conflicts with a Safari's hotkey. Whatever. new Shortcut(isMac ? 'Meta+;' : 'Ctrl+;', insertDateUTC, 'Insert date UTC', { force: true }), + new Shortcut(isMac ? "Meta+'" : "Ctrl+'", insertTimeLocal, 'Insert local time', { force: true }) ])) } } diff --git a/static/toolbar.js b/static/toolbar.js index 8b40967..1785f63 100644 --- a/static/toolbar.js +++ b/static/toolbar.js @@ -93,7 +93,7 @@ function insertDateUTC() { } function insertTimeUTC() { - let time = new Date().toISOString().substring(11, 19) + " UTC" + let time = new Date().toISOString().substring(11, 16) + " UTC " textInserter(time)() } @@ -108,7 +108,7 @@ function insertDateLocal() { function insertTimeLocal() { let d = new Date() - textInserter(`${len2(d.getHours())}:${len2(d.getMinutes())}:${len2(d.getSeconds())}`)() + textInserter(`${len2(d.getHours())}:${len2(d.getMinutes())} `)() } function insertUserlink() {