Skip to content

Khal cannot parse ISO8601 from system default #1469

@Reihar

Description

@Reihar

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 printformats picks 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions