1

I am fetching Timezones from an external API (Xero), but the display names returned here are different than those in rails. I am struggling to properly convert them to rails recognisable timezones.

Examples of timezones being returned by the API are:

  • (UTC) Dublin, Edinburgh, Lisbon, London
  • (UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague, etc.

The list of original timezones can be found here.

Also, i have this URL, which provides information about converting them to rails way, but I am not sure how to do that as they are in comments.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
Jakub Kopyś
  • 670
  • 8
  • 20
  • Are you getting that full display string? Or are you getting the strings in the `value` attribute shown in the Xero timezone xsd you linked to? – Matt Johnson-Pint Jun 28 '18 at 17:14
  • See also https://github.com/XeroAPI/XeroAPI-Schemas/issues/56 – Matt Johnson-Pint Jun 28 '18 at 17:23
  • Are you using [Xero's `organisation` API](https://developer.xero.com/documentation/api/organisation)? If so, it looks like the answer to my first question is clearly that you're getting the `value`, not the element name. Or are you using some other API? – Matt Johnson-Pint Jun 28 '18 at 17:28
  • @MattJohnson yes, I am getting the value, but I can easilly map these to diplay names. I do not think that these values are any easier to convert to rails timezone than display names? – Jakub Kopyś Jun 29 '18 at 07:18

0 Answers0