Internationalization and localization tools


Locale-Sensitive JavaScript Method

date.toTimeString();

Internationalization (I18n) Method Overview

The toTimeString method returns the time part of the date object in U.S. English format, based on system's local time zone.

For example: 17:00:03 GMT-0600 (Mountain Daylight Time)

Click here (w3schools) and here (MDN) for additional details.

I18n Issues

Whether or not calling toTimeString is an i18n issue is dependent on how it is being used in the application. Two possible issues are:

  • The system's time zone is being used, rather than either UTC or the application's time zone.
  • The resulting string is not formatted based on locale; all users will see the string in American English

Suggested Replacement

To address either of these issues, call toLocaleTimeString, which supports formatting the time based on locale, as well as setting the time zone.


Globalyzer will detect this method and report it as an i18n issue. If you have determined that the call is being handled correctly, you can use Globalyzer's Ignore Comment functionality to ensure that it isn't picked up in a subsequent scan.



Locale-Sensitive JavaScript Methods

 

Lingoport internationalization and localization services and software