marcusolsson/obsidian-projects

Default name for new notes - the time function is invalid (illegal character)

Closed this issue · 3 comments

What happened?

I tried to create a new project to test local budgeting. Recognizing each transaction entry would be a separate file in the table, I attempted to set the default name as entry {{date}} {{time}} as it states they are supported variables. States contains illegal characters when using the time variable.

When I went to the table to create a dummy transaction, it was noticed that the colon inserted for the time variable is the illegal character in question

What did you expect to happen?

To receive an easily unique file name for each transaction file, with the variables available, to reduce entry friction.

How can we reproduce it (as minimally and precisely as possible)?

create a new project. under more settings attempt to use the time variable in default name for new notes field. Provides an illegal character warning. It will let you create the project, so click save. add a new row and the illegal colon in file name prevents note/row creation.

Screenshot (72)
Screenshot (71)

Anything else we need to know?

If there is another way to easily append or prepend a unique id as a default for new notes, it would reduce friction on multiple projects. it would be appreciated. I intended to use this feature for other projects. If the time variable won't work, or can't have the colon stripped automatically, could a different variable without illegal file name characters be supported for a unique id?

Plugin version

1.11.5

Obsidian version

1.1.9

OS

Windows

Currently, you can use commands like {{time:HH-mm}} to override the default HH:mm style.
image
image

I found it in the settings of core plugin Templates. For more information, you can refer to https://momentjs.com/docs/#/displaying/format/.
image

Thank you for that, it works like a charm. Maybe it might be worth simply updating the screen to state the format needed for other users on the variable entry screen.

I'm excellent at breaking things, not so good at fixing them. HA HA

I agree that the default time format isn't really useful for file names. I want templates to work like in native Obsidian, so I don't really want to change the default format, but maybe we can change the description to say something like:

Supports {{date:YYYY-MM-DD}} and {{time:HHmm}} templates variables.

I'm excellent at breaking things, not so good at fixing them.

I'm pretty good at fixing things, but I need help finding things to fix. So please keep breaking Projects and tell us how you did it! 😆