DateTime.FromString does not correctly handle creation of DateTime objects if the string passed happens to fall in a timeframe that was “skipped” in history due to a timezone shift. For example, on Jan 1, 1933 Singapore jumped ahead, so if you try to construct a DateTime with “1933-01-01 00:00:00” Xojo throws the following exception:
Parse error: date needs to be in the format of YYYY-MM-DD HH:MM or YYYY-MM-DD
This directly contradicts the Xojo documentation for DateTime, which states:
When no locale is specified, the dateValue parameter can be in either SQLDate (YYYY-MM-DD) or SQLDateTime (YYYY-MM-DD HH:MM:SS) formats.
(Note that the docs say to include the Seconds, while the exception indicates they should be dropped)
If you instead try “1933-01-01 00:00” (drop the seconds, per the exception message) it fails with the exact same exception message.
I’d suggest that throwing an exception in this case is the wrong way to handle it. Here is a screencast I created that goes over what I found, how I found it, and what I suggest should be done instead:
There are hundreds (if not thousands) of edge cases throughout history when timezones shift and skip time, leaving holes in the timeline of certain timezones. These need to be handled gracefully somehow.
Should I open a feedback issue with this? I see there have been several in the past… but the problem persists.