I am trying to validate a date entry with the following code:
[code]Using Xojo.Core
dim mm As Integer = Val(pcMM.Text)
dim dd As Integer = Val(pcDD.Text)
dim yy As Integer = Val(pcYY.Text)
dim wDate as new Date(yy, mm, dd, TimeZone.Current)
if (wDate.Month <> mm) or (wDate.Day <> dd) or (wDate.Year <> yy) then
return false
else
return true
end
[/code]
When trying to validate February 31, 2019 it comes back invalid on Mac OS, but valid on Windows.
Using the debugger, I see the value of wDate.Month and wDate.Day are 3 and 31 respectively on the Mac. On Windows, the values are 2 and 31.
The only way I can validate on Windows is to change my code to insert the following lines just before doing the validity comparison.
dim TextDate As Text = wDate.ToText
wDate = wDate.FromText(TextDate)
This is easy enough, but seems silly. What am I missing?