Internationalization and localization tools


Locale-Sensitive JavaScript Method

date.toUTCString();

Internationalization (I18n) Method Overview

This method converts a date object to a string, using UTC Time Zone. UTC stands for Universal Coordinated Time and is the primary time standard for the world; it can be used interchangeably with Greenwich Mean Time (GMT), though UTC supersedes GMT. While the format of the date string is browser dependent, it will use U.S. English.

For example:

var date = new Date();
var str = date.toUTCString();


Would return something like this:

Mon, 22 Sep 2014 21:06:55 GMT

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

I18n Issues

toUTCString does not take into account the locale of the application; instead the returned string will always be a fixed U.S. English format. You will need to look at each toUTCString call to ensure that the string is not displayed to a user that expects date formatting to be based on locale.

Suggested Replacement

To format dates, times and numbers based on locale and a specified time zone, call one of the following methods:

toLocaleDateString
toLocaleString
toLocaleTimeString



To format dates, times and numbers in the ISO 8601 Standard format and UTC time zone, call:

toISOString


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