Bug 1463266 - clean up white-space in mailnews/base/content/dateFormat.js. r=jorgk
authoraceman <acelists@atlas.sk>
Sat, 08 Dec 2018 15:07:00 +0100
changeset 33869 9e7cf2d56e1532d215965c6fce6693be8299b546
parent 33868 c3afcea69ad2f397df3ec89b316b859106332d57
child 33870 4ec85e9cf4a02424ac12f97e4665fd5bb3fa6fbb
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersjorgk
bugs1463266
Bug 1463266 - clean up white-space in mailnews/base/content/dateFormat.js. r=jorgk
mailnews/base/content/dateFormat.js
--- a/mailnews/base/content/dateFormat.js
+++ b/mailnews/base/content/dateFormat.js
@@ -25,43 +25,43 @@ function initLocaleShortDateFormat()
     const dateFormatter = new Services.intl.DateTimeFormat(undefined,
       { dateStyle: "short" });
     var aDate = new Date(1999, 11, 1);
     var dateString = dateFormatter.format(aDate).replace(/ /g,"");
 
     // find out the separator
     var possibleSeparators = "/-.";
     var arrayOfStrings;
-    for ( var i = 0; i < possibleSeparators.length; ++i )
+    for (let i = 0; i < possibleSeparators.length; ++i)
     {
-      arrayOfStrings = dateString.split( possibleSeparators[i] );
-      if ( arrayOfStrings.length == 3 )
+      arrayOfStrings = dateString.split(possibleSeparators[i]);
+      if (arrayOfStrings.length == 3)
       {
         gSearchDateSeparator = possibleSeparators[i];
         break;
       }
     }
 
     // check the format option
-    if ( arrayOfStrings.length != 3 )       // no successful split
+    if (arrayOfStrings.length != 3)  // no successful split
     {
       dump("getLocaleShortDateFormat: could not analyze the date format, defaulting to mm/dd/yyyy\n");
     }
     else
     {
-      // the date will contain a zero if that system settings include leading zeros
+      // The date will contain a zero if the system settings include leading zeros.
       gSearchDateLeadingZeros = dateString.includes("0");
 
       // match 1 as number, since that will match both "1" and "01"
-      if ( arrayOfStrings[0] == 1 )
+      if (arrayOfStrings[0] == 1)
       {
         // 01.12.1999 or 01.1999.12
         gSearchDateFormat = arrayOfStrings[1] == "12" ? 5 : 6;
       }
-      else if ( arrayOfStrings[1] == 1 )
+      else if (arrayOfStrings[1] == 1)
       {
         // 12.01.1999 or 1999.01.12
         gSearchDateFormat = arrayOfStrings[0] == "12" ? 3 : 2;
       }
       else  // implies arrayOfStrings[2] == 1
       {
         // 12.1999.01 or 1999.12.01
         gSearchDateFormat = arrayOfStrings[0] == "12" ? 4 : 1;
@@ -87,17 +87,17 @@ function initializeSearchDateFormat()
     gSearchDateFormat = parseInt(gSearchDateFormat);
 
     // if the option is 0 then try to use the format of the current locale
     if (gSearchDateFormat == 0)
       initLocaleShortDateFormat();
     else
     {
       // initialize the search date format based on preferences
-      if ( gSearchDateFormat < 1 || gSearchDateFormat > 6 )
+      if (gSearchDateFormat < 1 || gSearchDateFormat > 6)
         gSearchDateFormat = 3;
 
       gSearchDateSeparator =
         Services.prefs.getComplexValue("mailnews.search_date_separator",
                                        Ci.nsIPrefLocalizedString);
 
       gSearchDateLeadingZeros =
         (Services.prefs.getComplexValue(
@@ -126,20 +126,20 @@ function convertPRTimeToString(tm)
 }
 
 function convertDateToString(time)
 {
   initializeSearchDateFormat();
 
   var year = time.getFullYear();
   var month = time.getMonth() + 1;  // since js month is 0-11
-  if ( gSearchDateLeadingZeros && month < 10 )
+  if (gSearchDateLeadingZeros && month < 10)
     month = "0" + month;
   var date = time.getDate();
-  if ( gSearchDateLeadingZeros && date < 10 )
+  if (gSearchDateLeadingZeros && date < 10)
     date = "0" + date;
 
   var dateStr;
   var sep = gSearchDateSeparator;
 
   switch (gSearchDateFormat)
   {
     case 1:
@@ -214,9 +214,8 @@ function convertStringToPRTime(str)
   month -= 1; // since js month is 0-11
 
   var time = new Date(year, month, date);
 
   // JavaScript time is in milliseconds, PRTime is in microseconds
   // so multiply by 1000 when converting
   return (time.getTime() * 1000);
 }
-