#748·jc

System Locale 12h format breaks date command parser

Author: MichalisDBACreated Sep 10, 2026Updated Sep 10, 2026
Labelsbugready-to-ship

When a system has 12h format in the date command like below:

localectl status
System Locale: LANG=en_US.UTF-8

date Output: Thu Sep 10 11:10:44 AM EEST 2026

jc can not parse it.

jc-restapi  | [2026-09-10 08:10:44,303] ERROR in app: Exception on /v1/parse/date [POST]
jc-restapi  | Traceback (most recent call last):
jc-restapi  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1511, in wsgi_app
jc-restapi  |     response = self.full_dispatch_request()
jc-restapi  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 919, in full_dispatch_request
jc-restapi  |     rv = self.handle_user_exception(e)
jc-restapi  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 917, in full_dispatch_request
jc-restapi  |     rv = self.dispatch_request()
jc-restapi  |   File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 902, in dispatch_request
jc-restapi  |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
jc-restapi  |   File "/app/app.py", line 46, in parse_data
jc-restapi  |     return {"result": parse(parser_name, data, raw=raw)}
jc-restapi  |   File "/usr/local/lib/python3.9/site-packages/jc/lib.py", line 512, in parse
jc-restapi  |     return jc_parser.parse(data, quiet=quiet, raw=raw, **kwargs)
jc-restapi  |   File "/usr/local/lib/python3.9/site-packages/jc/parsers/date.py", line 177, in parse
jc-restapi  |     'year': dt.year,
jc-restapi  | AttributeError: 'NoneType' object has no attribute 'year'

It only parses when the system locale is C.UTF-8 the 24h format without the AM and PM in the command output like:

Thu Sep 10 11:10:44 EEST 2026