Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrgDate does not support locales with not capitalized weekdays. #392

Open
jspulido opened this issue Jan 3, 2025 · 0 comments
Open

OrgDate does not support locales with not capitalized weekdays. #392

jspulido opened this issue Jan 3, 2025 · 0 comments

Comments

@jspulido
Copy link

jspulido commented Jan 3, 2025

Summary

The date and time regular expressions in orgdate.py only match capitalized weekdays. As a consequence agenda-related commands can not find such timestamps. Please note that, out of the box, orgmode-<LocalLeader>-sa and orgmode-<LocalLeader>-si will use the current locale and will insert such lowercase timestamps.

Reproduction

Run command :OrgAgendaTimeline on a .org file containing the following lines:

* TODO Found <2025-01-03 Fri>
* TODO Should be found <2025-01-03 vie>
* TODO Found <2025-01-03 Vie>

The obtained buffer contains:

TODO Found <2025-01-03 Fri>
TODO Found <2025-01-03 Vie>

The desired/expected buffer should contain:

TODO Found <2025-01-03 Fri>
TODO Should be found <2025-01-03 vie>
TODO Found <2025-01-03 Vie>

Related code

# <2011-09-12 Mon>
_DATE_REGEX = re.compile(r"<(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w>", re.UNICODE)
# [2011-09-12 Mon]
_DATE_PASSIVE_REGEX = re.compile(r"\[(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w\]", re.UNICODE)
# <2011-09-12 Mon 10:20>
_DATETIME_REGEX = re.compile(
r"<(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w (\d{1,2}):(\d\d)>", re.UNICODE)
# [2011-09-12 Mon 10:20]
_DATETIME_PASSIVE_REGEX = re.compile(
r"\[(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w (\d{1,2}):(\d\d)\]", re.UNICODE)
# <2011-09-12 Mon>--<2011-09-13 Tue>
_DATERANGE_REGEX = re.compile(
# <2011-09-12 Mon>--
r"<(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w>--"
# <2011-09-13 Tue>
r"<(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w>", re.UNICODE)
# <2011-09-12 Mon 10:00>--<2011-09-12 Mon 11:00>
_DATETIMERANGE_REGEX = re.compile(
# <2011-09-12 Mon 10:00>--
r"<(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w (\d\d):(\d\d)>--"
# <2011-09-12 Mon 11:00>
r"<(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w (\d\d):(\d\d)>", re.UNICODE)
# <2011-09-12 Mon 10:00--12:00>
_DATETIMERANGE_SAME_DAY_REGEX = re.compile(
r"<(\d\d\d\d)-(\d\d)-(\d\d) [A-Z]\w\w (\d\d):(\d\d)-(\d\d):(\d\d)>", re.UNICODE)
.

Locale examples

$ LC_ALL=en_US.UTF-8 date "+%a" --date=@0
Thu
$ LC_ALL=es_ES.UTF-8 date "+%a" --date=@0
jue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant