Open maximbelyayev opened 3 months ago
Link to #889
When you configure the columns prior to creating a task, the fields do get recognised as a date field. Thus wenn the table is empty, create a new column which for example is date_templater_test
and set it to date - but it comes with a new issue. Once there is at least a single task having a date everything seems to work.
With that setup, my actual issue comes into play: When creating a note with anything that is not date inside (in my case a Templater expression, but just typing a word also breaks it) of it, Projects View breaks with a RangeError
. Project Switch does not work anymore, new Task does not appear, other tasks cannot be modified anymore.
Only way to get everything working again: Close and reopen the View.
The Screenshot below shows the situation directly after creation of the note. The File explorer shows that Note 2
exists, the second row of the Projects Table View is also present.
Probably all happens due to the fact that the Templater Expression is not yet replaced when the Task is parsed.
What happened?
Obsidian Project note templates with YAML datetime properties or any type of YAML date/datetime field generated via Templater are not recognized by Obsidian Project as date/datetime fields when said templates are used to create a note.
In the below image, the right tab is my template which contains the YAML properties I want to test. The left tab is the resulting Obsidian Project table after creating a note via this tab. As you see, only one field (static date) is recognized by Obsidian Projects as a date/datetime field.
For context, I'm using Templater to automatically update date_created and date_modified fields that I want to have.
What did you expect to happen?
I expected date fields ('YYYY-MM-DD') to be recognized by Obsidian projects as a field of type 'Date'.
I expected datetime fields ('YYYY-MM-DD HH:MM') to be recognized by Obsidian projects as a field of type datetime ('Date' with 'Enable time' option automatically selected).
How can we reproduce it (as minimally and precisely as possible)?
Create a template that contains two YAML properties with the following values:
Optionally, also install/enable the Templater plugin and in Templater options, enable "Trigger Templater on new file creation". This is so that when Obsidian Projects creates a new note via a template, any templater code in the template is executed (as described in https://github.com/marcusolsson/obsidian-projects/pull/889)
Then, add third and fourth YAML properties to the template with the following value:
Finally, create a new note using said template with these two/four YAML properties and check results in the Obsidian Projects Table view. You will see that
date_test
is automatically recognized as a date field, whereasdatetime_test
,date_templater_test
, anddatetime_templater_test
are recognized as 'Text' fields.Anything else we need to know?
I think for the Templater test fields, because
date_templater_test
doesn't get recognized butdate_test
does, it could be that Obsidian projects picks up the Templater code text and sets the field to type text, then only after this field type is set by Obsidian projects does Templater render its code to the datetime. Just a hypothesisWill the eventual/future feature to change field type fix this issue? In that these fields may still not be recognized by Obsidian projects as date/datetime fields, but I can change the field type and it will force these fields in future notes to conform from text type to date/datetime type.
Plugin version
1.17.4
Obsidian version
1.6.7
OS
macOS