Skip to content

Commit

Permalink
Fixed bug with time stamp display in single digit days
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
frossm committed Aug 1, 2023
1 parent b02cdea commit e384b6d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.fross</groupId>
<artifactId>quoter</artifactId>
<version>5.0.16</version>
<version>5.0.17</version>
<packaging>jar</packaging>

<name>quoter</name>
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/org/fross/quoter/QuoteConsoleOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit e384b6d

Please sign in to comment.