From d3824f1a0784e3493f083b6b8cbfd08c3a2d87de Mon Sep 17 00:00:00 2001 From: Kenric Ashe <26514157+kenricashe@users.noreply.github.com> Date: Sat, 11 Oct 2025 18:57:31 -0700 Subject: [PATCH] refactor: var tz inside for loop scope instead of outside after confirming that is just as performant due to no lexical scope when Lucee is compiled to Java --- moment.cfc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/moment.cfc b/moment.cfc index fabce93..46443a7 100755 --- a/moment.cfc +++ b/moment.cfc @@ -190,13 +190,12 @@ component displayname="moment" { } public struct function getZoneTable(){ - var tz = ""; // Use Java 8+ Time API to avoid Java 16+ module access issues var zoneIdClass = createObject('java', 'java.time.ZoneId'); var list = zoneIdClass.getAvailableZoneIds().toArray(); var instant = createObject('java', 'java.time.Instant').ofEpochMilli(javacast('long', getSystemTimeMS())); var data = [:]; // ordered struct - for (tz in list){ + for (var tz in list){ //display *CURRENT* offsets var zoneId = zoneIdClass.of(tz); var offsetSeconds = zoneId.getRules().getOffset(instant).getTotalSeconds();