Hi all,
I have a feature request pertaining to date parsing in the date-time
entry prompt (=C-.=).
* Motivation
The prevailing date format where I live is D/M/Y, often abbreviated to
D/M. While I prefer Y-M-D as a persistent storage format, I naturally
default to D/M and prefer it for data entry. Especially when entering
recent dates (with =org-read-date-prefer-future= set to nil), which
usually do not require the year component and therefore the unambiguous
ISO 8601 format (Y-M-D) is slower to input in full, and does not match
the locally conventional order (D/M) when abbreviated (M-D).
* Proposal
The =org-read-date= function understands slash-separated dates in the
"american" format (M/D/Y and M/D). This code could be modified so that
the parsing of slash-separated dates depends on user preference, by
introducing a configuration variable like =calendar-date-style=, which
I'm tentatively naming =org-read-date-style=. Like
=calendar-date-style=, this would change the parsing of slash-separated
dates by =org-read-date=, but it would not change the order of arguments
passed to date-processing functions.
It would support at least =american= (M/D and M/D/Y) and =european= (D/M
and D/M/Y) options.
* Example
By default, =org-read-date-style= would be =american=, and so the date
"12/3" entered at the =C-.= prompt would be interpreted as December 3rd.
If =org-read-date-style= were set to =european=, the same date input
"12/3" would be interpreted as the 12th of March.
* Alternatives and Extensions
- =org-read-date= could simply read the value of =calendar-date-style=
rather than introducing a new configuration item. I propose a new item
because of the well-documented pitfalls of =calendar-date-style=.
- There could be an option to entirely forbid dates in slash-separated
formats, if the user wishes to avoid the possibility of this kind of
misinterpretation. I have not proposed this as I have no use for it.
- This could simply be left to each user's own configuration (i.e.
patching the org-mode code on a per-user basis). I suspect this feature
would help other org-mode users who habitually use D/M/Y. (side-note: I
have not attached a patch as I am yet to complete the copyright
assignment, but I thought the feature was worthwhile to request regardless.)
* Prior Discussion
I did a quick search over the archives to see if this had been proposed
before, but the closest I could see to this request was
[[https://list.orgmode.org/20130129193653.6460d...@hsdev.com/][Date/time
promptĀ parses '3-2' as 'Month-Day', can I configure it to parse it as
'Day-Month' ?]], which does not address slash-separated dates, and
[[https://list.orgmode.org/876322hcps.wl%25ded-...@ddoherty.net/][Date
Prompt Bug (or Anomoly)]] which covers the same code but doesn't address
intentionally entering D/M/Y dates.
Regards,
Zoey