Skip to content

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

@jspulido

Description

@jspulido

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions