Trim date strings for the date picker#2258
Conversation
When the date picker attempts to convert a date string into a numeric timestamp, trim the string. Otherwise the `luxon.DateTime.fromFormat` method fails to parse the string into a numeric timestamp. This most likely fixes issue openwebwork#2257.
|
This doesn't appear to fix the issue. I have ran A little more fiddling around, if I delete the space between the time and |
|
I am unable to reproduce what you are seeing in either Firefox or Chrome. If there is are spaces before or after the time, then I see the issue without this pull request though. |
|
I wonder if it is a translations issue now, if I go change the translation to Spanish, I notice that the input box of the set dates and the override dates are formatted differently (there is a comma in the set dates but not the override dates). So using Spanish I'm unable to copy/paste the dates, but if I use German it works fine. |
This is the match the Perl Spanish date time format.
|
The date/time format for Spanish in the javascript did not match the Perl date/time format. I fixed that. So that will fix the issue for Spanish. |
|
That doesn't explain your AM/PM comments. |
|
Yea, it is odd, I'm now fairly certain it is due to a space character being different. Here is a screenshot between a correctly formatted time and the one in the set input box. Do you also see a difference between the size of the space between the time an AM? Maybe it is some issue with the locales on my server. |
|
When I copy-pasted a date into: |
|
Thanks for the link @Alex-Jordan, this is what I get when I copy/paste the date into that link. For some reason my server is using the |
|
Note that there are some issues with time formats in some of the languages. The intent of this pull request was to fix your original issue which was in the US time format. In Korean there is no way to make the Perl and Javascript formats match. Perl for some reason does not interpret the AM/PM, while javascript does. So the Perl format gives The Greek language has another issue. Flatpickr uses an invalid language code ( I really, can not reproduce what you are seeing with the AM/PM thing. It could be the version of the Perl DateTime module on your system. What version of that module do you have installed? |
|
Also check the version of the |
|
On my system I have version 1.55 of DateTime, and 2.24 of Date::Format (although Date::Format is not actually used for this now that I look closer). Probably the module that is most relevant is DateTime::Locale. Check that version. That is 1.33 on my system. |
|
Here are the versions of the libraries in Debian stable (bookworm): |
|
Oh missed one, DateTime::Locale is 1.37. The most relevant thing I see in the changelog in 1.37 is "Rebuilt all locale data with the data from CLDR 42.0.0". Maybe there was an update to using that narrow space for AM/PM there. |
|
Okay, I just verified it is due to that change in 1.37, as seems the new time specification wants to use a narrow space. I downgraded to 1.35 and I no longer see the issue. Seems like this is something we should prepare for as more and more servers upgrade their |
|
Also found this, seems Java knows about this already and has a note to expect some issues. |
|
This now also replaces narrow no-break spaces with regular spaces. So it will work with newer versions of DateTime::Format. |
|
@drgrice1 Any reason you are only updated I can confirm this works and fixes my issue. Thanks. |
|
Yeah, I forgot. I will update that when I get a chance. |
This will be an issue with newer versions of DateTime::Format that are built on newer versions of CLDR that use these types of spaces in some formats.
fca3270 to
01353b0
Compare
|
I fixed the other location. I decided to also fix the Greek language for this while I was at it. When the Greek language support was added to webwork, a date/time format for the javascript was not. Also, we need to work around flatpickr's incorrect |
7cb62cf to
f65bb0c
Compare
There are two issues here. First, the Greek language was added recently, but a date/time format for the datepicker javascript was not added. Second, the flatpickr library incorrectly names the locale `gr` instead of `el`. So that has to be worked around.
f65bb0c to
65f88a7
Compare
somiaj
left a comment
There was a problem hiding this comment.
Thanks for the updates. Works well now.
| 'cs-CZ': 'dd.LL.yy H:mm', | ||
| de: 'dd.LL.yy, HH:mm', | ||
| es: 'd/L/yy H:mm', | ||
| el: 'd/L/yy, h::mm a', |
There was a problem hiding this comment.
It looks like you have a second : here.
There was a problem hiding this comment.
Also in problemset.js. When testing this, perl only adds a single :.
Trim date strings for the date picker and such (hotfix of #2258)



When the date picker attempts to convert a date string into a numeric timestamp, trim the string. Otherwise the
luxon.DateTime.fromFormatmethod fails to parse the string into a numeric timestamp.This most likely fixes issue #2257.