Long Date Format (Tue November 14, 2023) #15
Replies: 3 comments 4 replies
-
Thanks for your interest! I'm currently on my phone so I'll definitely give you a long answer later but let me ask a few things.
Do you want this functionality but the output to be long date format? Or a simple long date of today, meaning literally the date that's invoked? As a sidenote, parsing file names written in the long date format would be quite a pain and I'm hoping that's not what you want lol. |
Beta Was this translation helpful? Give feedback.
-
Other common formats of interest might be:
|
Beta Was this translation helpful? Give feedback.
-
Hi @iicurtis , as of v2.0.1, you now have the following options.
As I stated here: https://github.com/pysan3/neorg-templates#snippets_overwrite, there is a global option to specify the output format of all
If you don't want to alter the default behavior, but still want to use a different style occasionally, I refactored the default snippets so that you can specify the date format individually. More details here: https://github.com/pysan3/neorg-templates#keywords. neorg.setup({
-- ...
["external.templates"] = {
config = {
keywords = {
TODAY_OF_ORG = function() -- detect date from filename and return in org date format
local ls = require("luasnip")
local s = require("neorg.modules.external.templates.default_snippets")
return ls.text_node(s.parse_date(0, s.file_name_date(), [[%Y-%m-%d %a]])) -- 2006-11-01 Wed
end,
NOW_IN_DATETIME = function() -- print current date+time of invoke
local ls = require("luasnip")
local s = require("neorg.modules.external.templates.default_snippets")
return ls.text_node(s.parse_date(0, os.time(), [[%Y-%m-%d %a %X]])) -- 2023-11-01 Wed 23:48:10
end,
}
},
},
} |
Beta Was this translation helpful? Give feedback.
-
Thanks for making this project! I think it's a great use of an existing tool to extend another one.
Do you happen to have a snippet that creates the current date in a long written format? I am hoping for something similar to
TODAY_OF_FILENAME
but with a different end format. Unfortunately, I don't know where the documentation is for the format function in this snippet. Does it support day of week and month of year?Example:
Tue November 14, 2023
orTue 14 November 2023
Beta Was this translation helpful? Give feedback.
All reactions