I’m working with 2019r3.1
Dim d As DateTime = DateTime.FromString(“1977-05-23”)
Dim d As DateTime = DateTime.FromString(“1977-05-22”)
causes a RuntimeException: “Parse error: date needs to be in the format of YYYY-MM-DD HH:MM or YYYY-MM-DD”
I have tried other dates, without errors.
So far, it seems that the only problem is with the date that I have indicated above.
can someone explain me?
Works for me. Perhaps a copy and paste and something “wrong” in the quotes or the quotes themselves?
Select the string including the quotes in the ide, then right click “clean invisble characters”
The string may be corrupted (for example on copy and paste)
Hah! Didn’t know this one yet, good one. Always copying into Sublime Text and back
thank you for your support.
I had tried with Xojo 2019r3.1 on Windows 10: I confirm that it still does not work.
then I tried with Xojo 2019r3.1 on Windows 10 (Parallel VM on Mac): it works.
finally I tried with Xojo 2020r1.2 on Mac: it doesn’t work.
I don’t understand.
Could this be a localization/language issue? Does the Parallels VM have different settings from the systems where it fails?
I will check the settings well, but I ask myself: why is May 22 fails and May 23 works?
in this behavior localization/language can be important?
keep in mind that I’m working with thousands of different dates and this seems to be the only date with problems.
I can’t make the date crash. Using macOS Catalina with Xojo 2020r1 and Italian language.
I understand that the problem I’ve described may seem at least strange, perhaps not very credible.
I’ve made several tests before writing here.
I will carefully check the settings of the environments I’ve listed and I will update you.
Nope, no worries - interesting issue. Did you try your code with a simple newly created Desktop App, or are you running this code in a larger app? It would be good to create a new app, with nothing else than your sample code and check if that one fails as well or not.
sorry, I had forgotten these details.
it is a webapp.
after the first attempts with my project, for the other tests that i described above, I simply created a new application, inserting that code in the Session.Open event.
a screenshot from a new desktop app with only this code.
Win 10: English
Regional format: Italian (Italy)
Very strange, this code is just fine and is running for me … :-(. You should open a ticket with Xojo on this.
If you make the string a variable or a constant does ot work then?
Might just be your font, but to me the separators in your string look suspiciously long. Are you sure you used hyphens and not dashes?
That was my suspicion as well, but then he would likely get an error during compilation and not only at runtime, right? Very, very strange … @Giacomo_Bernardi what happens if you are writing the “buggy” line 4 exactly than line 2?
Dim dNew as DateTime = ...
But I’m sure you tested this already. Do we have anyone here running Xojo on an Italian Windows 10, who could help? These non-English system issues are often a pain in the neck.
Just adding data. Also cannot replicate this issue here.
No, because he’s passing a string into a method. The compiler would have no business parsing that at compile time.
I messed up “separators” and “quotes” … one way or the other, we’ll either all have a good laugh once we found the solution, or it is a weird serious bug.
I had used a string to simplify.
but using a variable the result is the same