xojo.core.locale.raw and nil oddity

I was wanting to come up with my own sqldate for the new framework date and came up with:

Function sqldate(extends d as xojo.core.date) As text return d.totext(xojo.core.locale.raw, xojo.core.date.FormatStyles.Medium, xojo.core.date.FormatStyles.none) End Function

It works, but returns the time. I can filter that out but I thought it was odd so I searched around and found this discussion. They found the same thing with the time, but they were talking about a nil locale. That made it sound like behind the scenes, a nil locale is actually xojo.core.locale.raw. Since I’m a fan of less typing I substituted nil for the locale in my function:

Function sqldate(extends d as xojo.core.date) As text return d.totext(nil, xojo.core.date.FormatStyles.Medium, xojo.core.date.FormatStyles.none) End Function

This doesn’t work and gives an interesting error:


The Raw locale only accepts the Medium Date/Time format styles[/code]

Raw locale? I entered nil, not Raw. So that also sounds like nil = xojo.core.locale.raw. But if you explicitly tell it to use Raw, it works, despite what the exception with nil says.

It looks as if xojo.core.local.raw isn’t ever nil.

It’s set up as nil in ToText, but because that field isn’t optional, Locale.Raw passes it a value it wants.

My assumption was that if there’s a nil locale in totext, Xojo replaces it with Raw. Is that your understanding? If so shouldn’t totext(raw,… and totext(nil,… be interpreted the same?

Hm, I see where you could gather that:

I have no insight on that :confused:
Why not just pass it a locale?