Make Date/Util.ts eslint clean
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 30 Oct 2020 08:24:24 +0000 (09:24 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 30 Oct 2020 09:50:35 +0000 (10:50 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js
wcfsetup/install/files/ts/WoltLabSuite/Core/Date/Util.ts

index d3bea93f384fa73ea528e483867a1104be9f3b41..fe7821c0bfa9ea81f9ce4caba91c1ed476103474 100644 (file)
@@ -67,22 +67,28 @@ define(["require", "exports", "tslib", "../Language"], function (require, export
                 case "g":
                     // `1` through `12`
                     hours = date.getHours();
-                    if (hours === 0)
+                    if (hours === 0) {
                         char = "12";
-                    else if (hours > 12)
+                    }
+                    else if (hours > 12) {
                         char = (hours - 12).toString();
-                    else
+                    }
+                    else {
                         char = hours.toString();
+                    }
                     break;
                 case "h":
                     // `01` through `12`
                     hours = date.getHours();
-                    if (hours === 0)
+                    if (hours === 0) {
                         char = "12";
-                    else if (hours > 12)
+                    }
+                    else if (hours > 12) {
                         char = (hours - 12).toString();
-                    else
+                    }
+                    else {
                         char = hours.toString();
+                    }
                     char = char.padStart(2, "0");
                     break;
                 case "A":
@@ -145,7 +151,7 @@ define(["require", "exports", "tslib", "../Language"], function (require, export
                     char = date.getFullYear().toString();
                     break;
                 // timezone
-                case "P":
+                case "P": {
                     let offset = date.getTimezoneOffset();
                     char = offset > 0 ? "-" : "+";
                     offset = Math.abs(offset);
@@ -153,6 +159,7 @@ define(["require", "exports", "tslib", "../Language"], function (require, export
                     char += ":";
                     char += ("0" + (offset % 60).toString()).slice(-2);
                     break;
+                }
                 // specials
                 case "r":
                     char = date.toString();
index 8e471b3142b7a9de1dc7b58dac25f25904555f80..fdde58724321fdeac9f6ab9ca21c5b244f7e86fc 100644 (file)
@@ -71,16 +71,24 @@ export function format(date: Date, format: string): string {
       case "g":
         // `1` through `12`
         hours = date.getHours();
-        if (hours === 0) char = "12";
-        else if (hours > 12) char = (hours - 12).toString();
-        else char = hours.toString();
+        if (hours === 0) {
+          char = "12";
+        } else if (hours > 12) {
+          char = (hours - 12).toString();
+        } else {
+          char = hours.toString();
+        }
         break;
       case "h":
         // `01` through `12`
         hours = date.getHours();
-        if (hours === 0) char = "12";
-        else if (hours > 12) char = (hours - 12).toString();
-        else char = hours.toString();
+        if (hours === 0) {
+          char = "12";
+        } else if (hours > 12) {
+          char = (hours - 12).toString();
+        } else {
+          char = hours.toString();
+        }
 
         char = char.padStart(2, "0");
         break;
@@ -148,7 +156,7 @@ export function format(date: Date, format: string): string {
         break;
 
       // timezone
-      case "P":
+      case "P": {
         let offset = date.getTimezoneOffset();
         char = offset > 0 ? "-" : "+";
 
@@ -159,6 +167,7 @@ export function format(date: Date, format: string): string {
         char += ("0" + (offset % 60).toString()).slice(-2);
 
         break;
+      }
 
       // specials
       case "r":