From: Tim Düsterhus Date: Fri, 30 Oct 2020 08:24:24 +0000 (+0100) Subject: Make Date/Util.ts eslint clean X-Git-Tag: 5.4.0_Alpha_1~683 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c83398e268e34494bb1f45a6915b595a76f759a9;p=GitHub%2FWoltLab%2FWCF.git Make Date/Util.ts eslint clean --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js index d3bea93f38..fe7821c0bf 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Date/Util.js @@ -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(); diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Date/Util.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Date/Util.ts index 8e471b3142..fdde587243 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Date/Util.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Date/Util.ts @@ -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":