Khal cannot parse ISO8601 from system default
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.1k
- Forks
- 233
- Avg merge
- 1h 44m
- Merged PRs (30d)
- 1
Description
Describe the bug
While Khal seems to be able to pick up my time format from my locale.conf, it doesn't seem to be able to parse it without defining the locale manually.
To Reproduce
Steps to reproduce the behavior:
- Set your locale so that ISO8601 is selected as a time format in /etc/locale.conf, e.g.:
LANG=en_US.UTF-8
LC_TIME=en_DK.UTF-8
- Verify that
printformatspicks it up:
khal printformats
longdatetimeformat: 2013-12-21T21:45:00
datetimeformat: 2013-12-21T21:45:00
longdateformat: 2013-12-21
dateformat: 2013-12-21
timeformat: 21:45:00
- Look for events at a date:
khal at 2026-05-14T12:00:00:00
critical: Could not parse "['2026-05-14T00:00:00']".
critical: Please check your configuration or run `khal printformats` to see if this does match your configured [long](date|time|datetime)format.
critical: If you suspect a bug, please file an issue at https://github.com/pimutils/khal/issues/
- Edit your configuration to manually define that same datetime format:
[locale]
local_timezone= Europe/Paris
default_timezone= Europe/Paris
timeformat= %H:%M:%S
dateformat= %Y-%m-%d
longdateformat= %d.%m.%Y
datetimeformat= %Y-%m-%dT%H:%M:%S
longdatetimeformat= %Y-%m-%dT%H:%M:%S
- Run khal with the specified format
khal at 2026-05-14T12:00:00
2026-05-14T12:00:00
2026-05-14T12:00:00-2026-05-14T13:00:00 [REDACTED for privacy]
Expected behavior
I expected khal to parse the format in khal at as specified in khal printformats or khal printformats to return an error about the format not being recognized and requesting manually setting it in the configuration.
OS, version, khal version and how you installed it:
- khal: version 0.14.0
- OS: Archlinux
- Installation method: OS repo: extra/khal
- Python: 3.14.4
- Khal config file causing the issue:
[calendars]
[[default]]
path = ~/Calendars/default
color = dark magenta
priority = 20
[[reminders]]
path = ~/Calendars/reminders
color = dark green
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the locale.conf and khal configuration shown, then compare the parsing used by khal at with the formats reported by khal printformats. Trace the date and datetime parsing entry points and add a regression test for the ISO8601 system-default case. Done means the command accepts the displayed format without manually duplicating it in the configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, localization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100