Retrieving localization settings through REST API

Posted by mnashi on 21-Aug-2017 06:23

I would like to retrieve localization settings such as date format through a REST API. Need this information to parse date and datetime data properly in mobile app. Are there any APIs available to retrieve this data?

All Replies

Posted by Manooj Murali on 21-Aug-2017 07:32

Unfortunately, we don't have any API of this sort at the moment.

Posted by mnashi on 21-Aug-2017 08:13

Is it possible to use selectQuery API to retrieve the data from the object?

Posted by Mohammed Siraj on 22-Aug-2017 11:34

Rollbase API will return Date and Date-Time fields in ISO 8601 standard format (as per UTC timezone). Parsing such Date string literals should not require User's localization settings.

Additiionally, if required, you can define formula fields as wrappers over Date or Date-Time fields which will return a long value i.e. no. of milliseconds since 01/01/1970 EPOCH (UTC timezone is implicit). With this approach as well there will not be an overhead of parsing Date/Date-time string literals for API clients.

Eg: Formula :

//for a Date field 'dob'

return rbv_api.getFieldValue('Person',1234567,'dob').getTime();//returns long value i..e no. of millisecodns since EPOCH time

Posted by Thierry Ciot on 23-Aug-2017 11:47

This is not a direct answer to the initial post but it is relevant for future references and/or other users:

As part of client-side Javascript SDK we make PageLocalization object available using rbf_getPageContext().getPageLocalization().

It provides the following methods:

1) getDateFormat() — Returns a string representing the date format pattern, for example, "MM/dd/yyyy"

2) getDateTimeFormat() — Returns a string representing the date/time format pattern, for example, "MMM d, yyyy, h:mm tt"

3) getLongDateFormat() — Returns a string representing the long date format pattern, for example, "dddd, MMMM d, yyyy"

4) getLongDateTimeFormat() — Returns a string representing the long date/time format pattern, for example, "dddd, MMMM d, yyyy 'at' h:mm tt"

5) getTimeFormat() — Returns a string representing the time format pattern, for example, "h:mm tt"

6) getDateEditFormat() — Returns a string representing the date format pattern used on form pages (new, edit, quick create, status change) when showing Date field values in input widgets. This format is not in the user's localization settings and depends on the locale.

7) getDateTimeEditFormat() — Returns a string representing the date/time format pattern used on form pages (new, edit, quick create, status change) when showing DateTime field values in input widgets. This format is not in the user's localization settings and depends on the locale.

Thierry.

This object interface is documented in detail here: documentation.progress.com/.../

This thread is closed