Workaround for WebDatePicker format issue?

Oh, yes, fair point.

1 Like

Is there any workaround for this? When I set the session.LocalCode to en the web app crashes. When I set it to en-AU the picker doesn’t display properly when user makes a selection. Need DDMMYY format with 2021r1.1. Can’t go to r2 because JSON error handling has changed.

Is this still an issue? If so, has anyone raised an issue to Xojo?

We’ve had to create a container with a WebDatePicker that fills the container, with a WebLabel on top of it. If the user clicks the label, we give focus to the DatePicker and the calender appears. On the DateChanged event of the DatePicker, we set the Label.Text to whatever format we want displayed. This works but surely this is something the DatePicker should do built in?

Am I missing something?

It looks like this was fixed last year:

https://tracker.xojo.com/xojoinc/xojo/-/issues/63734

Can you give more information or an example of the problem you see?

image
I picked today’s date, and it’s appearing in US format. My locale settings are English (United Kingdom) across the board:

Am I supposed to be setting something in the code?

For web, the presentation layer works based on the browser settings. What the local desktop settings are, are not known for the remote web application.

You must adjust your browser accordingly to your choices like

Moved en-UK to top and refreshed Chrome

3 Likes

Thanks @Rick_Araujo ! That explains it and that’s entirely logical.

We are working in the NHS and that is exclusively English (United Kingdom) but I can’t rely that all browsers across the country are correctly set so I need to be able to control this at the server.

Looks like I’ll have to use my solution after all.

Thanks for your help.

1 Like

You could for example detect the user browser language/region, and if not en-UK, send them to a page explaining them how to change it to try again.

1 Like

I think you can try to force the WebSession.LanguageCode. In the WebSession.Opening event, paste this code:

Me.LanguageCode = "en-GB"
4 Likes

That works! I think I’ll do that!

Thanks

1 Like

IIRC, you can even assign the current web browser’s language code to this property, so your page will always use the user’s language. I don’t remember the exact code right now, but you can check the session headers and pass the relevant one to LanguageCode.

Xojo Web already does that by default, you only need to set the LanguageCode if you really want to override the browser’s settings :slight_smile:

1 Like