obsidian-tasks
obsidian-tasks copied to clipboard
When dates fail to parse, see if we can present info to the user about the problem
Description
Currently, when date strings are parsed and presented to users, we just show Invalid date
.
It would be a lot more helpful if we could also show what the invalid date was.
Perhaps something like: Invalid date (2022-02-30)
Required Steps
This will meaning finding all references to chrono.parseDate()
and chrono.parse()
in the code.
There is information in the results about what text was parsed.
It's a bit more complicated because the Tasks plugin then converts the chrono result to Date
, losing the text information.
This might be another case where the proposed TaskDate class is useful: #1104
How to Test
Create a task with an invalid due date, e.g. 2022-02-30
For example, copy this line:
- [ ] Do stuff 📅 2023-02-30
Edit the task with 'Create or edit task' and confirm that the original date text is visible somewhere.
The current result is:
View the file in Reading mode, and confirm it shows the date value
Currently:
View the task in a tasks code block, and confirm it shows the date value
Currently: