File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939__description__ = "A standards based terminal calendar"
4040__license__ = "Expat/MIT, see COPYING"
4141__homepage__ = "https://lostpackets.de/khal/"
42+
43+
44+ # Monkeypatch _strptime to support Python 3.15+ where parsing day of month (%d or %e)
45+ # without a year directive raises a ValueError.
46+ try :
47+ import _strptime
48+ except ImportError :
49+ pass
50+ else :
51+ _orig_strptime = _strptime ._strptime
52+
53+ def _custom_strptime (data_string , format_string ):
54+ has_year = "%y" in format_string or "%Y" in format_string
55+ has_day = "%d" in format_string or "%e" in format_string
56+ if has_day and not has_year :
57+ data_string = f"{ data_string } 2024"
58+ format_string = f"{ format_string } %Y"
59+ return _orig_strptime (data_string , format_string )
60+
61+ _strptime ._strptime = _custom_strptime
You can’t perform that action at this time.
0 commit comments