Open animaux opened 8 months ago
@animaux did you mix up the actual vs. expected columns?
Yes, absolutely, sorry, thanks. I switched it for the date as well now, since I feel it is more easily readable that way.
Please ignore my stuff. I assigned the wrong issue in a totally unrelated PR by accident 🙈
@animaux This one is really hard. I am trying to add some more patterns, but this will only help with some of these formats. The difficult part here is that the dayjs library is not failing to parse the dates - then we could simply communicate this. But it will match the input to different formats as it is very easy to do so when all the formats looking very similar. And thus you get unexpected results instead of errors.
And there currently is not good way to offer support for other languages than English.
Thanks for getting into this. Most of the Date examples are likely edge cases, apart from the straight forward Day-Monthname-Year dates in non-english languages (like 23. Juni 2024), which should at least work for the selected panel language, I feel.
I hope it’s not as difficult for the time field. I think it would be a sensible default to assume HHMM
for any four-digit number entered.
which should at least work for the selected panel language, I feel.
As I wrote, supporting other languages than English with the dayjs library is not quite feasible so far.
Time should work when https://github.com/getkirby/kirby/pull/6362 gets merged.
Description
When pasting or writing dates in times in their respective fields, in formats that do not match the final format, the values are intrepreted in strange ways with even the year switching on or two years. This can easily be overlooked by editors and leads to wrong dates being saved.
Apparently english dates with named months are interpreted correctly, but even those only when using day-month-year (which is the proper way of course :).
Of course everything works fine when using the predefines format and we cannot expect every arbitrary format to be interpreted correctly.
But since editors are expected to use shortcuts (like simply pasting data as it is), it would be nice to have either a decent interpretation in the panle language or a message urging the user to use a proper format if it can’t be interpreted properly.
Expected behavior
I’d expect the fields to try to interpret the entered data in a sensible manner or throw an error if they fail to do so.
To reproduce
Not sure if this is being used in any way when interpreting input data, but the setting in the
config.php
is:User language in the panel is set to german.
Time Field
Date Field (DD.MM.YYYY)
Your setup
Kirby 4.1.0 PHP 8.2.13
Your system