marcusolsson/obsidian-projects

Attempting to edit a date field with a cleared date results in invalid date error

Closed this issue · 2 comments

What happened?

This first happened to me when attempting to edit a field with an existing date in the board editor view. Clicking away from the date field caused the date to go blank, and then attempting to add a new date did not add anything—this eventually broke the Table view and "Include Fields" selector on the board view, and caused the date associated with the note to be "Invalid Date."

With more digging, this seems to happen when editing a date that has been cleared, either manually or by clicking away in the board tab editor. When attempting to set a date from a date that has not been cleared, everything works fine.

After editing a cleared date I see this warning:

The specified value "Invalid Date" does not conform to the required format, "yyyy-MM-dd".
p @ plugin:obsidian-projects:167
QV @ plugin:obsidian-projects:32
r1 @ plugin:obsidian-projects:32
Promise.then (async)
PO @ plugin:obsidian-projects:32
rq @ plugin:obsidian-projects:32
eval @ plugin:obsidian-projects:32
u @ plugin:obsidian-projects:197
o @ plugin:obsidian-projects:197
D @ plugin:obsidian-projects:197
eval @ plugin:obsidian-projects:32
Ee @ plugin:obsidian-projects:32
l @ plugin:obsidian-projects:167

Viewing the date with the Table view or with "Include Fields" checked on the Board tab gives this error:

plugin:obsidian-projects:197 Uncaught (in promise) RangeError: Invalid time value
    at CR (plugin:obsidian-projects:197:60826)
    at ure (plugin:obsidian-projects:197:61101)
    at U (plugin:obsidian-projects:32:7188)
    at new Ww (plugin:obsidian-projects:197:61506)
    at Array.Dre (plugin:obsidian-projects:197:65868)
    at Array._re (plugin:obsidian-projects:197:64461)
    at xR (plugin:obsidian-projects:197:63651)
    at AR (plugin:obsidian-projects:197:66683)
    at Kt (plugin:obsidian-projects:32:5129)
    at Object.p (plugin:obsidian-projects:197:67299)
CR @ plugin:obsidian-projects:197
ure @ plugin:obsidian-projects:197
U @ plugin:obsidian-projects:32
Ww @ plugin:obsidian-projects:197
Dre @ plugin:obsidian-projects:197
_re @ plugin:obsidian-projects:197
xR @ plugin:obsidian-projects:197
AR @ plugin:obsidian-projects:197
Kt @ plugin:obsidian-projects:32
p @ plugin:obsidian-projects:197
QV @ plugin:obsidian-projects:32
r1 @ plugin:obsidian-projects:32
Promise.then (async)
PO @ plugin:obsidian-projects:32
rq @ plugin:obsidian-projects:32
eval @ plugin:obsidian-projects:32
u @ plugin:obsidian-projects:167

What did you expect to happen?

  1. When clicking away from a date field in the Board editor view, the date field is not cleared
  2. When attempting to set a new date from a date that has been cleared, the date is set successfully

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

In Table view

  1. Create or use a note with a date field
  2. Clear the date from the field
  3. Attempt to set a new date
obsidian-issue-table.mov

In Board view

  1. Click on a note with a date field
  2. Click on the date field, then click away - this clears the date
  3. Attempt to set a new date
  4. To reproduce Uncaught RangeError, include date field in card view
obsidian-issue-board.mov

Anything else we need to know?

No response

Plugin version

1.17.4

Obsidian version

1.6.7

OS

macOS

Yeah I've just noticed it and pushed a fix in #931. Will deploy soon.

Date got cleared in Edit Note pop out by click outside is unexpected. Will do some investigation.

That's great to hear, thanks so much!