Message8280
I have been working through the changes and docs.
The biggest hangup is handling format strings for the dates.
For example: in German, "%d-%m-%Y" is common, for the US: "%m-%d-%Y"
is common.
After this change, when using the native date input, the format must be
"%Y-%m-%d" so that the native date input can parse/display it. Currently
the code throws an exception if format is set and does not exactly match
the required format.
Similar rules apply for datetime-local inputs.
I am considering just ignoring format if the input type is a
native date/datetime-local.
Alternatvely, ignore the date if it looks compatible. For example: "%m,%d|%Y"
is compatible with a date input. I can do this with )use set to get rid of ordering
issues):
set(re.findall('%([A-z])', format)) == set("Y", "m", "d")
to consider the format compatible with 'date' and
set(r.findall(...)) in [set(['Y', 'm', 'd', "H", "M"]),
set(['Y', 'm', 'd', "H", "M", "S"])]
to consider it compatible with datetime-local. A year/month format like: "%m-%Y" would
not be compatible and would throw an exception. (Yes weird formats like:
"%Y: %m %m-%d will be incorrectly accepted but ... they deserve it 8-).)
I don't like spending cpu cycles doing the compatibility test, but...
Thoughts? |
|
Date |
User |
Action |
Args |
2025-01-15 20:55:23 | rouilj | set | messageid: <1736974523.93.0.337964553052.issue2551390@roundup.psfhosted.org> |
2025-01-15 20:55:23 | rouilj | set | recipients:
+ rouilj, schlatterbeck, stefan, ber, tobias-herp, ThomasAH, ngaba |
2025-01-15 20:55:23 | rouilj | link | issue2551390 messages |
2025-01-15 20:55:23 | rouilj | create | |
|