From e384b6da044dc89ea1adc896ebf87634146e7dc5 Mon Sep 17 00:00:00 2001 From: Michael Fross Date: Tue, 1 Aug 2023 16:32:31 -0500 Subject: [PATCH] Fixed bug with time stamp display in single digit days An issue if the day number was < 10. Changed the DateTimeFormatter to just look for one "d". Also now prints the date in WHITE and adds a timezone if to the provided timestamp should we have an issue. --- pom.xml | 2 +- snap/snapcraft.yaml | 2 +- src/main/java/org/fross/quoter/QuoteConsoleOutput.java | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index fe58d32..77b4f21 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.fross quoter - 5.0.16 + 5.0.17 jar quoter diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 1129745..9c82aae 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: quoter -version: '5.0.16' +version: '5.0.17' summary: Command line utility to pull stock and index quotes description: | Quoter fetches online stock quotes and index data for easy display on diff --git a/src/main/java/org/fross/quoter/QuoteConsoleOutput.java b/src/main/java/org/fross/quoter/QuoteConsoleOutput.java index b3d3ad6..d180cfe 100644 --- a/src/main/java/org/fross/quoter/QuoteConsoleOutput.java +++ b/src/main/java/org/fross/quoter/QuoteConsoleOutput.java @@ -258,7 +258,7 @@ public void displayOutput(FileExporter exporter) { } // Parse the time stamp into a LocalDateTime object & set the to the Eastern time zone - LocalDateTime ldt = LocalDateTime.parse(timeStamp, DateTimeFormatter.ofPattern("MMM dd yyyy h:mma")); + LocalDateTime ldt = LocalDateTime.parse(timeStamp, DateTimeFormatter.ofPattern("MMM d yyyy h:mma")); ZonedDateTime zdtSrc = ldt.atZone(ZoneId.of("America/New_York")); // Get local time zone for this JVM from the JVM system properties @@ -269,11 +269,15 @@ public void displayOutput(FileExporter exporter) { timeStamp = zdtDest.format(DateTimeFormatter.ofPattern("MMM dd yyyy hh:mm a z (O)")); } catch (DateTimeParseException ex) { - // Take no action and just use the original timeStamp as received from the financial website + // Just take the original time stamp from the financial website after adding the time zone + timeStamp = timeStamp + " Eastern Time"; } } - Output.printColorln(Ansi.Color.CYAN, "Data as of " + timeStamp + ". Quotes are delayed."); + // Display the time stamp + Output.printColor(Ansi.Color.CYAN, "Data as of "); + Output.printColor(Ansi.Color.WHITE, timeStamp); + Output.printColorln(Ansi.Color.CYAN, ". Quotes are delayed."); // Display trending data if -t was provided and there is at least one valid symbol if (cli.clTrend == true) {