Richard Lawrence <richard.lawre...@uni-tuebingen.de> writes: > This is org 9.4 running from maint (commit ab00524fc). I spent a while > stepping through org-capture and org-read-date but haven't found the > problem yet. I suspect this snippet from a cond form in the middle of > org-capture-set-target-location: > > #+begin_src > ((string-match "\\([^ ]+\\)-[^ ]+[ ]+\\(.*\\)" > org-read-date-final-answer) > ;; Replace any time range by its start. > (apply #'encode-time > (org-read-date-analyze > ;; it looks to me like this is maybe sending the wrong value > ;; into org-read-date-analyze: > (replace-match "\\1 \\2" nil nil > org-read-date-final-answer) > > #+end_src
I can now confirm that this is the problem. It looks like what is happening here is that the regex is meant to match a time range, but ends up matching the date: thus a string like "12-31 13:00" gets mangled to "12 13:00" and sent into org-read-date-analyze. If I comment out this branch of the cond form, and enter "12-31 13:00" at the org-read-date-prompt, then both the timestamp and the location in the datetree are correct. So I guess the solution is...a better regex is needed to cause this branch to fire only in the intended case, namely, a time range. Should it be checking for "am"/"pm" or ":" or similar? Otherwise it seems impossible to distinguish a date specification like "11-12" from a time range. -- Best, Richard