From 0cf0da06f83e158a61a8fc780be99aa2b30ead42 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 12 Aug 2021 21:24:42 +0800 Subject: [PATCH] Snippet: add `ww` as the week number with leading zero --- src/snippet/snippetmgr.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/snippet/snippetmgr.cpp b/src/snippet/snippetmgr.cpp index 00cfcb4a..6b7d5c7f 100644 --- a/src/snippet/snippetmgr.cpp +++ b/src/snippet/snippetmgr.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -349,6 +350,12 @@ QVector> SnippetMgr::loadBuiltInSnippets() const [](const QString &) { return QString::number(QDate::currentDate().weekNumber()); }); + addDynamicSnippet(snippets, + "ww", + tr("the week number with a leading zero (`01` to `53`)"), + [](const QString &) { + return Utils::intToString(QDate::currentDate().weekNumber(), 2); + }); addDynamicSnippet(snippets, "H", tr("the hour without a leading zero (`0` to `23` even with AM/PM display)"),