Skip to content

Commit

Permalink
Error handling for invalid dates
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonski committed Dec 10, 2024
1 parent 37e62a4 commit e866a91
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1007,9 +1007,13 @@ class window.AnalysisRequestAdd
# we need to fetch the date and time input fields
date_input = field.querySelector("input[type='date']")
time_input = field.querySelector("input[type='time']")
date = new Date(value)
date_input.value = date.toISOString().split("T")[0]
time_input.value = date.toTimeString().split(" ")[0]
try
date = new Date(value)
date_input.value = date.toISOString().split("T")[0]
time_input.value = date.toTimeString().split(" ")[0]
catch error
console.warn error
site.add_notification("Invalid date format", "Please use the format yyyy-mm-dd MM:HH")

# trigger form:changed event
$(this).trigger "form:changed"
Expand Down

0 comments on commit e866a91

Please sign in to comment.