This topic is locked
[SOLVED]

Set PHPRunner Locale to Windows Regional Setting

3/2/2022 3:19:13 PM
PHPRunner General questions
J
jacktonghk authorDevClub member

Is it possible to allow a project to set the locale and regional setting to the client computer's regional setting? I also find that in the ResourceCalendar Template, the date picker will returns correct date only if I set the PHPRunner Regional Setting to EN_US which is 'MM/DD/YYYY', any advise? Thanks.

Best regards,
Jack Tong

Admin 3/3/2022

You can do something like this. Here is the article that explains how to get the end user locale in Javascript. You can figure out their language and locale settings, send this info to the server side and adjust date settings on the PHP side.

M
Mark Kramer 3/23/2022

Here is what I use to achieve local time zone.

First off I create a table called " Property Info" where I keep the demographics of the property, ie name, address, phone, timezone (RegCode), etc. (This could alson be set up on user profile instead of property). The logic is the Query returns the array value from PropertyInfo.RegCode" which in my case is "America/New_York" (These timezone names can be found here https://www.php.net/manual/en/timezones.php )

In the "After application is initialized" area of Events I insert this code:

*global $dal;
$tblpropertyinfo=$dal->Table("PropertyInfo"); // PropertyInfo is my custom table name
$rs = $tblpropertyinfo->QueryAll();
while ($data = dbfetcharray($rs))
$TimeZone.=$data["RegCode"];
datedefaulttimezoneset($TimeZone); //sets the timezone from the "RegCode" from "PropertyInfo"*


So by building the "PropertyInfo" table , I can have default settings for each location. I can have a currency field, a language field, a calender format field, etc.
I know this is not exactly what you ask for but it is close enough for insperation.